Skip to content

Instantly share code, notes, and snippets.

@mebcomputers
Created April 30, 2012 14:02
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 mebcomputers/2558567 to your computer and use it in GitHub Desktop.
Save mebcomputers/2558567 to your computer and use it in GitHub Desktop.
php: get latest twitter status
class twitter {
public $twitter_base = 'http://twitter.com/statuses';
public $twitter_username = '<-username->'; //Your username here
function latest(){
$url = "$this->twitter_base/user_timeline/$this->twitter_username.xml?count=5";
$content = file_get_contents($url);
$xml = new SimpleXMLElement($content);
$status_item = $xml->status;
$status = $status_item->text;
return $status;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment