Jump to content

cayoba

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by cayoba

  1. 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

     

     

     

×
×
  • 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.