feed twitter php
Tentando incrementar o feed do twitter no site, utilizando os metodos abaixo, de primeiro momento funciona mas derrepente para de funcionar. utilizei outros métodos e acontece o mesmo. o estranho é que quando troco um método pelo outro funciona e para novamente depois de um dado tempo.
$url = 'http://twitter.com/statuses/user_timeline/asfabbuzios.rss?count=1';
$xml = simplexml_load_file($url);
foreach($xml->channel->item as $node){
printf('<p>"<a href="%s">%s</a>"</p>',$node->link,$node->title );
}
ERRO:
simplexml_load_file(http://twitter.com/statuses/user_timeline/asfabbuzios.rss?count=1) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in /home/asfab/public_html/index.php on line 324
Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "http://twitter.com/statuses/user_timeline/asfabbuzios.rss?count=1" in /home/asfab/public_html/index.php on line 324
Warning: Invalid argument supplied for foreach() in /home/asfab/public_html/index.php on line 326
outro metodo que acontece a mesma coisa:
$username = "asfabbuzios";
// Prefix - some text you want displayed before your latest tweet.
// (HTML is OK, but be sure to escape quotes with backslashes: for example href=\"link.html\")
$prefix = "";
// Suffix - some text you want display after your latest tweet. (Same rules as the prefix.)
$suffix = "";
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1";
function parse_feed($feed) {
$stepOne = explode("<content type=\"html\">", $feed);
$stepTwo = explode("</content>", $stepOne[1]);
$tweet = $stepTwo[0];
$tweet = str_replace("<", "<", $tweet);
$tweet = str_replace(">", ">", $tweet);
return $tweet;
}
$twitterFeed = file_get_contents($feed);
echo " <font face='Verdana, Geneva, sans-serif' size='2'>".stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix)."</font>";Discussão (1)
Carregando comentários...