dotmatrixdesign: Twitter LED Scroller Build Log

davidnin1 [ at ] gmail.com
Dec 04
Permalink

So I write a little PHP code


$ch = curl_init();

// set URL and other appropriate options
$test_str = “http://twitter.com/statuses/friends_timeline/davidnin.xml”;
curl_setopt($ch, CURLOPT_URL, $test_str);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);

// grab URL and pass it a string
$str = curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);


if (!$myxml=simplexml_load_string($str)) {
    echo ‘Error reading the XML file’;
}

foreach($myxml as $status){

    echo $status->{‘user’}->{‘screen_name’} . “: ” . $status->{‘text’} . “\n”;

} //end for each status

?>