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:
- 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
- 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.