Created
April 30, 2012 14:02
-
-
Save mebcomputers/2558567 to your computer and use it in GitHub Desktop.
php: get latest twitter status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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