这个Twitter API脚本需要一分钟才能加载

时间:2012-12-28 17:15:47

标签: twitter simplexml

我使用一个非常简单的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);?>

0 个答案:

没有答案