无法从Twitter获取状态? [重复]

This question already has an answer here:

I want to get status from twitter to display on my site.

Here is the code

<?php

function getTwitterStatus($userid){
$url = "https://api.twitter.com/1/statuses/user_timeline/$userid.xml?
count=1&include_rts=1callback=?";

$xml = simplexml_load_file($url) or die("could not connect");

foreach($xml->status as $status){
$text = $status->text;
}
echo $text;
}

getTwitterStatus("soksovat");

?>

I want to get 1 status from userid = "soksovat", but when i run the above, two warnings are come out:

  1. Warning: simplexml_load_file(https://api.twitter.com/1/statuses/user_timeline/soksovat.xml?count=1&include_rts=1callback=?) [function.simplexml-load-file]: failed to open stream: HTTP request failed! HTTP/1.0 410 Gone in .......... line 6
  2. Warning: simplexml_load_file() [function.simplexml-load-file]: I/O warning : failed to load external entity "https://api.twitter.com/1/statuses/user_timeline/soksovat.xml?count=1&include_rts=1callback=?" in .............. line 6 count not connect

Can anyone help to solve this problem? I got stuck with it several day ago.

Thank in advance.

</div>

You have to update your old Twitter API 1.0 to Twitter API 1.1.

New Twitter API : https://dev.twitter.com/docs/api/1.1/overview

Get User Timeline : https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

Useful Twitter API v1.1 Class :

https://github.com/J7mbo/twitter-api-php/blob/master/TwitterAPIExchange.php