Hi everyone, Just wanting to know if this function is ok to connect and pull down twitter statuses. It works by the way!
<?php
function get_twitter_feed($screen_name){
$xml=new DOMDocument();
$xml->load("http://twitter.com/statuses/user_timeline.xml?
screen_name=".$screen_name);
$status_array=$xml->getElementsByTagName("statuses");
foreach($status_array as $status_array){
$status_list=$status_array->getElementsByTagName("status");
foreach($status_list as $status){
$date_node=$status->getElementsByTagName("created_at");
$text_node=$status->getElementsByTagName("text");
$i=0;
foreach($date_node as $date_node){
$date=$date_node->firstChild->nodeValue;
$date=substr($date, 0, 10);
$i++;
if($i==1){
print $date."<br />";
}
}
foreach($text_node as $text_node){
$text=$text_node->firstChild->nodeValue;
print $text."<br /><br />";
}
}
}
}
?>
