2
标题几乎总结了一下:我找不到任何页面使用获取状态与Twitter API。Twitter API - 获取状态不查找任何用户页面
这是我的代码。
<?php
session_start();
require "abraham/twitteroauth/autoload.php";
use Abraham\TwitterOAuth\TwitterOAuth;
$twitteruser = "IliaVED"; //User name I'm looking for
$id = "486654831"; //Corresponding id
$notweets = 30; //how many tweets you want to retrieve
$consumerkey = "xxx";
$consumersecret = "xxx";
$accesstoken = "xxx";
$accesstokensecret = "xxx";
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
echo json_encode($tweets);
echo $tweets;
?>
我试过使用ID而不是屏幕名称,它仍然没有找到它。
你可以清楚地看到,该用户是否存在:https://twitter.com/IliaVED
我试着用不同的用户和它同样的事情..
这是我的错误:
{"errors":[{"message":"Sorry, that page does not exist","code":34}]}
对不起,这是一个错字..它仍然不工作,得到相同的错误信息 – Charles
@Charles我更新了答案,请看看 –