December 15, 201213 yr I have a site displaying many rss feeds using javascript, I know that if I used php that web crawlers would be able to read the rss entries from the code. Considering I don't how to write javascript or php could anyone please give me any advice on how to do this, maybe a code generator or something.
December 16, 201213 yr Here's the basic PHP snippet for grabbing an RSS feed and putting it into a web page so passing bots can read it. Live demo is here Should work for most RSS feeds but not all use the same structure so I've marked the lines that may need tweeking. <?php $url="http://www.prisonplanet.com/feed"; $xml = simplexml_load_file($url); for ($i=0; $i<=2; $i++) { $title = $xml->channel[0]->item[$i]->title[0];// may need to be changed for some feeds $link = $xml->channel[0]->item[$i]->link[0];// may need to be changed for some feeds echo "<p><a href=\"$link\" rel=\"nofollow\" target=\"_blank\">$title</a></p>"; } ?>
December 16, 201213 yr Author Here's the basic PHP snippet for grabbing an RSS feed and putting it into a web page so passing bots can read it. Live demo is here Should work for most RSS feeds but not all use the same structure so I've marked the lines that may need tweeking. <?php $url="http://www.prisonplanet.com/feed"; $xml = simplexml_load_file($url); for ($i=0; $i<=2; $i++) { $title = $xml->channel[0]->item[$i]->title[0];// may need to be changed for some feeds $link = $xml->channel[0]->item[$i]->link[0];// may need to be changed for some feeds echo "<p><a href=\"$link\" rel=\"nofollow\" target=\"_blank\">$title</a></p>"; } ?> Thank you very much.
Create an account or sign in to comment