| | |
RSS 2.0 with PHP not working
Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2009
Posts: 2
Reputation:
Solved Threads: 0
Hi Guys,
I am trying to create an RSS in PHP. I have the following code which should work but I get an error saying FEED ERROR when I run the code. The code does run and display an XML file if I remove <rss version="2.0"> , I really don't know what the problem could be. Please see if you can help me find a solution.
Many thanks in advance
I have the following code
and the header file is
I am trying to create an RSS in PHP. I have the following code which should work but I get an error saying FEED ERROR when I run the code. The code does run and display an XML file if I remove <rss version="2.0"> , I really don't know what the problem could be. Please see if you can help me find a solution.
Many thanks in advance
I have the following code
<?
2
3 class RSS
4 {
5 public function RSS()
6 {
7 require_once ('pathto.../mysql_connect.php');
8 }
9
10 public function GetFeed()
11 {
12 return $this->getDetails() . $this->getItems();
13 }
14
15 private function dbConnect()
16 {
17 DEFINE ('LINK', mysql_connect (DB_HOST, DB_USER, DB_PASSWORD));
18 }
19
20 private function getDetails()
21 {
22 $detailsTable = "webref_rss_details";
23 $this->dbConnect($detailsTable);
24 $query = "SELECT * FROM ". $detailsTable;
25 $result = mysql_db_query (DB_NAME, $query, LINK);
26
27 while($row = mysql_fetch_array($result))
28 {
29 $details = '<?xml version="1.0" encoding="ISO-8859-1" ?>
30 <rss version="2.0">
31 <channel>
32 <title>'. $row['title'] .'</title>
33 <link>'. $row['link'] .'</link>
34 <description>'. $row['description'] .'</description>
35 <language>'. $row['language'] .'</language>
36 <image>
37 <title>'. $row['image_title'] .'</title>
38 <url>'. $row['image_url'] .'</url>
39 <link>'. $row['image_link'] .'</link>
40 <width>'. $row['image_width'] .'</width>
41 <height>'. $row['image_height'] .'</height>
42 </image>';
43 }
44 return $details;
45 }
46
47 private function getItems()
48 {
49 $itemsTable = "webref_rss_items";
50 $this->dbConnect($itemsTable);
51 $query = "SELECT * FROM ". $itemsTable;
52 $result = mysql_db_query (DB_NAME, $query, LINK);
53 $items = '';
54 while($row = mysql_fetch_array($result))
55 {
56 $items .= '<item>
57 <title>'. $row["title"] .'</title>
58 <link>'. $row["link"] .'</link>
59 <description><![CDATA['. $row["description"] .']]></description>
60 </item>';
61 }
62 $items .= '</channel>
63 </rss>';
64 return $items;
65 }
66
67 }
68
69 ?>and the header file is
<?
2 header("Content-Type: application/xml; charset=ISO-8859-1");
3 include("classes/RSS.class.php");
4 $rss = new RSS();
5 echo $rss->GetFeed();
6 ?>![]() |
Similar Threads
- rss php feed not working or validating (RSS, Web Services and SOAP)
- php is not working (PHP)
- Help with PHP, not working on page (PHP)
- How to create rss.php file (PHP)
- download pdf file, convert to html, in PHP since working in Linux (PHP)
- php is not working (PHP)
Other Threads in the RSS, Web Services and SOAP Forum
- Previous Thread: RSS Feeds Tag Generation
- Next Thread: final year project...Pls Help!!!
| Thread Tools | Search this Thread |
.htaccess 301 accept access alltop api authentication binarysecuritytoken blog card collaboration credit data development ebay email evernote flash google government highrise htaccess intel internet legal live netbeans patent paypal php podcast proxy redirect rss rssfeeds searchmonkey server service soap software swappingxmlfromflash swappingxmlnodes url web webservices webservicesecurity wiki wikipedia xerces xml xslt y!os yahoo ydn





