Skip to content

Instantly share code, notes, and snippets.

@John2496
Created June 4, 2010 16:58
Show Gist options
  • Save John2496/425663 to your computer and use it in GitHub Desktop.
Save John2496/425663 to your computer and use it in GitHub Desktop.
<?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