Skip to content

Instantly share code, notes, and snippets.

@tjlytle
Created November 8, 2010 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjlytle/667833 to your computer and use it in GitHub Desktop.
Save tjlytle/667833 to your computer and use it in GitHub Desktop.
Example getting follower count and last status using SimpleXML and the Twitter API. Any information returned from the show API (http://dev.twitter.com/doc/get/users/show) can be accessed.
<?php
function getUser($name){
$user = simplexml_load_file('http://twitter.com/users/show.xml?screen_name='.$name);
return $user;
}
$user = getUser('tjlytle');
echo $user->followers_count;
​echo $user->status->text;​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
@tjlytle
Copy link
Author

tjlytle commented Nov 8, 2010

Any information returned from the Show API can be accessed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment