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