It looks like we're working on something very similar here, at least as far as trying to grab results from Summize/Twitter and do stuff with them.
I spent a bit of time last week to work on a script (also using Magpie) to essentially mimic the currently disabled Track feature on Twitter with a Summize RSS feed by parsing the results and SMSing them to me through teleflip. And of course, I'm willing to share with the community, so here's what I've got:
<?php
/*
* TwitterTrack
* A useless hack for supplementing Twitter's tracking until its fixed
*
* Nick Tabick - nicktabick@gmail.com
*/
// Start by importing MagpieRSS
require_once('./rss_fetch.inc');
require_once('./rss_utils.inc');
// Get the last run time from disk (in epoch)
// I used intval() here because PHP seemed to assume the value was a string otherwise.
$lastrun = intval(file_get_contents('./lastrun.txt'));
// Define the RSS Url for Summize/Twitter Search we're using, and get it.
$rss = fetch_rss('http://search.twitter.com/search.atom?q=%40nicktabick+OR+techcentric');
// Iterate through each item returned in the feed
foreach ($rss->items as $item) {
// Convert the time to a usable standard (epoch)
$published = parse_w3cdtf($item['published']);
// If the epoch time is greater than our last run...
if ( $published >= $lastrun ) {
// ...get all the fun stuff out of the feed and e-mail it to Teleflip for SMS
mail('nonono@youcanthavethis', 'Tweet', ' ' . preg_replace('/\s\((\w+)\)/', '', $item['author_name']) . ': ' . $item['title'] . ' (' . date('m/d/y H:i',$published) . ')', "From: useyourown@ccount");
}
}
// Dump the current time (in epoch) so we can use it as a base value for next run.
// The + 300 is to help sync the difference in clocks. This can be edited as necessary.
file_put_contents('./lastrun.txt',(date('U') + 300));
?>
The time difference math is, like the comment says, to help with differences in timestamps and avoid duplicates if your clocks are off. However, I just came to the realization that while this works, perhaps a more effective option would be to store the last timestamp from the feed.
This script should be friendly to any difference in time zones, as the timestamps are based upon GMT anyway. (I say 'epoch time' in my comments; by 'epoch time', I mean the number of seconds since the Unix epoch.) My script uses e-mail to send SMS notifications to my phone via Teleflip, but it would be easily adapted with the appropriate system() command from your source, Darren.
Feel free to improve this script as necessary, or do whatever with it. Credit would be lovely, but considering there's always someone who's going to rip off work, I really don't care. This didn't take that long to write, anyway.
Happy hacking!
EDIT: I forgot to mention, but I also made a small edit to rss_utils.inc (one of the Magpie files) that may or may not be necessary. If the script doesn't work at first, try changing this line in rss_utils (should be line 28):
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
to
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(Z)?/";
If it isn't noticeable already, this is the regular expression used to parse the time in the RSS feed.