Get Latest Twitter Status


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

via @kenrick1991


Copy this code and paste it in your HTML
  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. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.