La siguiente función permite mostrar los últimos tweets de un usuario. Tan sólo debemos pasarle como parámetro el nombre de usuario de la cuenta y el número de tweets a mostrar.
function my_twitter($usuario,$tweets) {
$feed = "http://search.twitter.com/search.atom?q=from:" . $usuario . "&rpp=" . $tweets;
$xml = simplexml_load_file($feed);
foreach($xml->children() as $child) {
foreach ($child as $value) {
if($value->getName() == "content") {
$content = $value . "";
echo '<p class="twit">'.$content.'</p>';
}
}
}
}
Por ejemplo
my_twitter("webintenta",5);
mostraría los ultimos 5 tweets del usuario webintenta.



