由于Twitter API 1.0从2013年6月11日退役,下面的脚本不再工作。
// Create curl resource
$ch = curl_init();
// Set url
curl_setopt($ch, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/myscreenname.json?count=10");
// Return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// Close curl resource to free up system resources
curl_close($ch);
if ($output)
{
$tweets = json_decode($output,true);
foreach ($tweets as $tweet)
{
print_r($tweet);
}
}
如何用最少的代码获得user_timeline(最近的状态)?
我发现这个:https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline 但是我得到以下错误:
"{"errors":[{"message":"Could not authenticate you","code":32}]}"
有很多课程,但在尝试了几个之后,它们似乎都没有工作,因为Twitter上的这些更新,加上其中一些是非常高级的课程,有很多功能,我真的不需要。
用PHP获取最近用户状态的最简单/最短的方法是什么?