2010-03-21 4 views
0

Im en utilisant une boucle pour aller chercher mes favoris Twitter:Twitter Favoris et plus de 20

<?php 
$username = "bob"; 
$password = "password"; 
$twitterHost = "http://twitter.com/favorites.xml"; 
$curl; 
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2); 
curl_setopt($curl, CURLOPT_HEADER, false); 
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password"); 
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 
curl_setopt($curl, CURLOPT_URL, $twitterHost); 
$result = curl_exec($curl); 
curl_close($curl); 
header('Content-Type: application/xml; charset=ISO-8859-1'); 
print $result; 
?> 

Toutefois, ce ne récupèrera que les 20 derniers favoris, pas tous.

Si je modifie cette ligne:

$twitterHost = "http://twitter.com/favorites.xml"; 

Et changer à:

$twitterHost = "http://twitter.com/favorites.xml?page=2"; 

je peux obtenir la prochaine série de 20 favoris.

Il ne semble pas y avoir de toute façon, en utilisant l'API Twitter, pour savoir combien de pages de favoris il y a.

En tant que tel, quelqu'un peut-il suggérer le meilleur moyen d'obtenir tous les favoris?

Si ce n'est pas possible, obtenez tous les Tweets pour une plage de dates?

Répondre