Hola vamos a ver como obtener mis últimos tweets mediante PHP. 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.

Función
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>';
			}	
		}
	}	
}
Ultimos 5 tweets
my_twitter("nombre_usuario",5);
0
Puntos
1301
Visitas
0
Resp
Por demonio23 hace 10 años
Mods
Para comentar Inicia sesión o Regístrate
Phpres 2025@ All rights reserved.
Utilizamos cookies para mejorar la navegación en el sitio. Más información Aceptar