Posted By

rickfu on 11/01/09


Tagged

php twitter


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

kkathman
seloh77


Get Latest Twitter Status


 / Published in: PHP
 

URL: http://css-tricks.com/snippets/php/get-latest-twitter-status/

via @kenrick1991

  1. <?php
  2.  
  3. function getTwitterStatus($userid){
  4. $url = "http://twitter.com/statuses/user_timeline/$userid.xml?count=1";
  5.  
  6. $xml = simplexml_load_file($url) or die("could not connect");
  7.  
  8. foreach($xml->status as $status){
  9. $text = $status->text;
  10. }
  11. echo $text;
  12. }
  13.  
  14. //my user id USERNAME
  15. getTwitterStatus("USERNAME");
  16.  
  17. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: xt1an on January 4, 2010

is there a way to turn this into a link as well? (ie: http://twitter.com/blahblahuser/statuses/99999999)

You need to login to post a comment.