cayoba Posted September 5, 2011 Share Posted September 5, 2011 Hello I am new thought I would ask help here as I was not getting much help on another forum. I have this code <?php header("content-type: text/xml"); $rssfeed = '<?xml version="1.0" encoding="UTF-8"?>'; $rssfeed .= '<rss version="2.0">'; $rssfeed .= '<channel>'; $rssfeed .= '<title>My Price Savings Coupons.com Feed</title>'; $rssfeed .= '<link>http://www.mypricesavings.com</link>'; $rssfeed .= '<description>This is coupons.com feed</description>'; $rssfeed .= '<language>en-us</language>'; $rssfeed .= '<copyright>Copyright (C) 2011 mypricesavings.com</copyright>'; function compareFeeds($a, $b){ //this function will compare the "val" array element of each $itemRSS if ($a["val"] == $b["val"]) { return 0; } return ($a["val"] < $b["val"]) ? -1 : 1; } $doc = new DOMDocument(); $doc->load('http://rss.coupons.com/xmlserve.asp?go=14520kk5210'); $arrFeeds = array(); foreach ($doc->getElementsByTagName('item') as $node) { $itemRSS = array ( 'val' => $node->getElementsByTagName('value')->item(0)->nodeValue, 'image' => $node->getElementsByTagName('image')->item(0)->nodeValue, 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, 'exp' => $node->getElementsByTagName('activedate')->item(0)->nodeValue ); array_push($arrFeeds, $itemRSS); } usort($arrFeeds, 'compareFeeds'); foreach($arrFeeds as $itemRSS){ $descrip = '<![CDATA[ <p><a href="'.$itemRSS["link"].'"><img src="'. $itemRSS["image"].'" align="left" border="0" height="80" width="80" alt="'.$itemRSS["desc"].'"/></a></p>]]>'; $descrip .= '' .$itemRSS["desc"]; $rssfeed .= '<item>'; $rssfeed .= '<title>' . $itemRSS["desc"] . '</title>'; $rssfeed .= '<link>' . $itemRSS["link"] . '</link>'; $rssfeed .= '<pubDate>' . $itemRSS["exp"] . '</pubDate>'; $rssfeed .= '<description>'. $descrip . '</description>'; $rssfeed .= '</item>'; } $rssfeed .= '</channel>'; $rssfeed .= '</rss>'; echo $rssfeed; ?> The purpose of this code is to take http://rss.coupons.com/xmlserve.asp?go=14520kk5210 and turn it into a true RSS Feed. I currently have the php above at mypricesavings.com/coupons/couponsfeed.php I receive the error in google chrome on mac, however, in safari it does work, If I were to use RSS Graffiti on facebook it also errors Thank you for any help, Also, If there is a better more efficient way to accomplish what I am trying to do, please share with me so I may learn better Derrick Quote Link to comment https://forums.phpfreaks.com/topic/246504-cannot-find-my-error/ Share on other sites More sharing options...
jcbones Posted September 5, 2011 Share Posted September 5, 2011 What is the error? Quote Link to comment https://forums.phpfreaks.com/topic/246504-cannot-find-my-error/#findComment-1265782 Share on other sites More sharing options...
cayoba Posted September 5, 2011 Author Share Posted September 5, 2011 I have attached the screencap [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/246504-cannot-find-my-error/#findComment-1265784 Share on other sites More sharing options...
jcbones Posted September 6, 2011 Share Posted September 6, 2011 I don't "see" anything that would cause an error, unless the data you are pulling has an illegal character in it. You will have to use some de-bugging tools (echo mainly) to find it. Or look at the page source. Quote Link to comment https://forums.phpfreaks.com/topic/246504-cannot-find-my-error/#findComment-1265794 Share on other sites More sharing options...
cayoba Posted September 6, 2011 Author Share Posted September 6, 2011 thank you for attempting, its starting to move beyond frustrating Quote Link to comment https://forums.phpfreaks.com/topic/246504-cannot-find-my-error/#findComment-1265803 Share on other sites More sharing options...
jon23d Posted September 6, 2011 Share Posted September 6, 2011 Can we see the rest of your code please? Quote Link to comment https://forums.phpfreaks.com/topic/246504-cannot-find-my-error/#findComment-1265834 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.