There are a ton of ways to do this, but the one I’ve found that’s consistent and transparent utilizes twitter’s json service. The upshot is this:

$user = 'qozix';
$uri = "http://twitter.com/statuses/user_timeline/{$user}.json?count=10";
$raw = file_get_contents($uri);
$data = json_decode($raw);

which gives back an array of “tweets” – the text property of each element is the one with the actual string of the tweet.

so if you wanted to grab a random tweet from the last 10, it might look like this:

$user = 'qozix';
$uri = "http://twitter.com/statuses/user_timeline/{$user}.json?count=10";
$raw = file_get_contents($uri);
$data = json_decode($raw);
$length = count($data);
$index = rand(0, $length - 1);
$tweet = $data[$index];
$html = $tweet->text;
print $html;

if you wanted to linkify it, just add some RegExp…

$user = 'qozix';
$uri = "http://twitter.com/statuses/user_timeline/{$user}.json?count=10";
$raw = file_get_contents($uri);
$data = json_decode($raw);
$length = count($data);
$index = rand(0, $length - 1);
$tweet = $data[$index];
$html = $tweet->text;
$trimmed = trim($html);
$linked = preg_replace('/(https?:\/\/\S+)/', '<a target="_blank" href="\1">\1</a>', $trimmed);
print $linked;

and if you wanted the most recent tweet (instead of random), also linkified…

$user = 'qozix';
$uri = "http://twitter.com/statuses/user_timeline/{$user}.json?count=1";
$raw = file_get_contents($uri);
$data = json_decode($raw);
$tweet = end($data);
$html = $tweet->text;
$trimmed = trim($html);
$linked = preg_replace('/(https?:\/\/\S+)/', '<a target="_blank" href="\1">\1</a>', $trimmed);
print $linked;

(not the change in the web service’s URI – for the most recent tweet, no need to get last 10 results… just grab the last result)