Most recent Twitter status


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. function get_status($twitter_id, $hyperlinks = true) {
  3. $c = curl_init();
  4. curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
  5. curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  6. $src = curl_exec($c);
  7. preg_match('/<text>(.*)<\/text>/', $src, $m);
  8. $status = htmlentities($m[1]);
  9. if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $status);
  10. return($status);
  11. }
  12. ?>

URL: http://abeautifulsite.net/notebook/75

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.