Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

RSS Feeds

Featured Replies

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.

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>";
 }
?>

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.