You can push any RSS feed you like to your iPhone using Prowl if you have access to a web server and don't mind getting your hands dirty.
1. Purchase Prowl from the app store and register for an account
2. Get the Prowl PHP class from -
http://code.google.com/p/php-prowl/
3. Get SimplePie to handle RSS feeds from:
http://simplepie.org/
4. Edit the below code to contain your user details and your feed(s) you want displayed
5. Upload class.prowl.php, simplepie.inc and whatever you call your cusotmized script (mine is facebook.php as I use it to push Facebook notifications)
6. Create a sub-directory cache in the directory you placed the files in step 5 and make it writable by the web server (777)
7. Create an empty file saveditems.php and make it writable as well
8. Load your script in your browser for testing, it should forward all notifications for each new item to your iPhone (first time will send a lot), empty out saveditems.php after doing that to make testing the scheduled cron job easier
9. Setup a cron job (using cPanel it is easy but just google for instructions) to run:
wget -O /dev/null
http://yourdomain.com/path/to/your/swcript/facebook.php
and schedule it to run however often you want, it isn't true PUSH but having a pull ever minute is close enough for me!
Here is the script (which is almost entirely one of the SimplePie examples that I modified a little:
PHP:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Demo of how to use SimplePie and a flat file database to display old feed items</title>
</head>
<body>
<?php
/*
This is a demo showing how to use SimplePie and a flat file database to display previous feed items like Google Reader.
Summary
Load the flat file db into array.
Run SimplePie.
Add new feed items to the array.
Save the array back to the flat file db.
Loop through the db to display feed items.
Author: Michael Shipley (http://www.michaelpshipley.com/)
Changelog
20090711 - Jason Bainbridge - http://jasonbainbridge.com
Added some slight modifications to add support for the Prowl iPhone app:
- Includes class.prowl.php and initiates a new session
- Reverses the array of new items so the list in the Prowl app is in descending order
- Pushes each new item to Prowl
*/
require 'simplepie.inc';
include "class.prowl.php";
$prowl = new Prowl("your_username", "your_password", "what_you_want_your_app_name_to_be");
// db holder
$savedItems = array();
// db file name
$savedItemsFilename = 'saveditems.php';
// max days to keep items in db
$numberOfDays = 3;
$numberOfDaysInSeconds = ($numberOfDays*24*60*60);
$expireDate = time() - $numberOfDaysInSeconds;
//you can have one or many rss feeds listed here
$urls = array('www.somedomain.com/feed.rss','anotherdomain.com/feeed.xml);
$feed = new SimplePie();
$feed->set_feed_url($urls);
$feed->set_cache_duration(100);
$feed->init();
/*
load flat file db into array
*/
if(file_exists($savedItemsFilename))
{
$savedItems = unserialize(file_get_contents($savedItemsFilename));
if(!$savedItems)
{
$savedItems = array();
}
}
/*
Loop through items to find new ones and insert them into db
*/
foreach(array_reverse($feed->get_items()) as $item)
{
// if item is too old dont even look at it
if($item->get_date('U') < $expireDate)
continue;
// make id
$id = md5($item->get_id());
// if item is already in db, skip it
if(isset($savedItems[$id]))
{
continue;
}
// found new item, add it to db
$i = array();
$i['title'] = $item->get_title();
$i['link'] = $item->get_link();
$i['author'] = '';
$author = $item->get_author();
if($author)
{
$i['author'] = $author->get_name();
}
$i['date'] = $item->get_date('U');
$i['content'] = $item->get_content();
$feed = $item->get_feed();
$i['feed_link'] = $feed->get_permalink();
$i['feed_title'] = $feed->get_title();
$result = $prowl->send("FB Notification", $i['title']);
$savedItems[$id] = $i;
}
/*
remove expired items from db
*/
$keys = array_keys($savedItems);
foreach($keys as $key)
{
if($savedItems[$key]['date'] < $expireDate)
{
unset($savedItems[$key]);
}
}
/*
sort items in reverse chronological order
*/
function customSort($a,$b)
{
return $a['date'] <= $b['date'];
}
uasort($savedItems,'customSort');
/*
save db
*/
if(!file_put_contents($savedItemsFilename,serialize($savedItems)))
{
echo ("<strong>Error: Can't save items.</strong><br>");
}
/*
display all items from db
*/
echo '<h2>SimplePie + flat file database</h2>';
$count = 1;
foreach($savedItems as $item)
{
echo $count++ . '. ';
echo '<strong>' . $item['feed_title'] . '</strong>';
echo ' : ';
echo $item['title'];
echo '<br>';
echo '<small>' . date('r',$item['date']) . '</small>';
echo '<br>';
echo '<br>';
}
/*
for comparison, show all feed items using SimplePie only
*/
echo '<h2>SimplePie only</h2>';
$count = 1;
foreach($feed->get_items() as $item)
{
echo $count++ . '. ';
$iFeed = $item->get_feed();
echo '<strong>' . $iFeed->get_title() . '</strong>';
echo ' : ';
echo $item->get_title();
echo '<br>';
echo '<small>' . $item->get_date('r') . '</small>';
echo '<br>';
echo '<br>';
}
/*
Total counts
*/
echo '<h2>Total item counts</h2>';
echo 'Database item count: ' . count($savedItems);
echo '<br>';
echo 'SimplePie item count: ' . $feed->get_item_quantity();
echo '<br>';
?>
</body>
</html>