Jump to content

Cannot find my error


cayoba

Recommended Posts

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

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.