Created
June 4, 2010 16:58
-
-
Save John2496/425663 to your computer and use it in GitHub Desktop.
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
<?php | |
class Twitter | |
{ | |
public static function user_id($username) | |
{ | |
$data = file_get_contents('http://twitter.com/' . $username); | |
$userId = explode('<div id="user_', $data); | |
$userId = explode('"', $userId[1]); | |
$userId = $userId[0]; | |
return $userId; | |
} | |
public static function feed($username) | |
{ | |
$userId = self::user_id($username); | |
$data = file_get_contents('http://twitter.com/statuses/user_timeline/' . $userId . '.json'); | |
$tweets = json_decode($data); | |
return $tweets; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment