Revision: 12069
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 1, 2009 04:29 by nerdsane
Initial Code
<?php function get_status($twitter_id, $hyperlinks = true) { $c = curl_init(); curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1"); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); $src = curl_exec($c); curl_close($c); preg_match('/<text>(.*)<\/text>/', $src, $m); $status = htmlentities($m[1]); if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $status); return($status); } ?>
Initial URL
http://abeautifulsite.net/notebook/75
Initial Description
To find your numerical Twitter ID, login to Twitter and click on your RSS feed (bottom of the page). The URL will look something like http://twitter.com/statuses/friends_timeline/12345678.rss. Your ID will be the 12345678.
Initial Title
Get Your Most Recent Twitter Status Using PHP
Initial Tags
curl, twitter
Initial Language
PHP