我使用一个非常简单的Twitter PHP脚本来获取最新的2条推文,但有时需要一分钟才能加载。此代码未优化吗?
<?php
function getTwitterStatus($userid){
$url = "https://api.twitter.com/1/statuses/user_timeline/$userid.xml?count=2&include_rts=1callback=?";
$xml = simplexml_load_file($url) or die("could not connect");
foreach($xml->status as $status){
$text = $status->text;
}
echo $text;
}
getTwitterStatus("BillGates",1);?>