/ Published in: PHP
Extracts the most recent tweet from the users RSS feed and auto-detects links.
Expand |
Embed | Plain Text
function parse_feed($feed) { '/<description>(.*?)<\/description>/s', $feed, $tweets, PREG_SET_ORDER ); $tweet = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $tweets[1][1]); return $tweet; } $feed = "http://twitter.com/statuses/user_timeline/26248137.rss"; // Without the function and storing it in a user's cookie that is checked every 30min '/<description>(.*?)<\/description>/s', $feed, $tweets, PREG_SET_ORDER ); $tweet = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $tweets[1][1]); if (!$_COOKIE['lasttweet']) { echo $tweet; }else{ }
You need to login to post a comment.
