<?php // get twitter.com/2600, and store it in $output $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://twitter.com/2600'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'); $output = curl_exec($ch); curl_close($ch); // search through $output for the latest tweet $start_string = '<span class="entry-content">'; $start = strpos($output, $start_string, 0) + strlen($start_string); $end = strpos($output, '</span>', $start); $tweet = substr($output, $start, $end-$start); // display this tweet to the screen echo(trim($tweet)."\n"); ?>