我正在使用脚本来获取特定 Twitter 用户 ID 的数据。推特用户 ID 是1897279429
.
我想显示它的名称和图像。我有以下使用 Twitter 库的脚本。
$this->load->config('twitter');
require_once APPPATH.'libraries/TwitterAPIExchange.php';
$settings = array(
'oauth_access_token' => $this->config->item('access_token'),
'oauth_access_token_secret' => $this->config->item('access_token_secret'),
'consumer_key' => $this->config->item('consumer_key'),
'consumer_secret' => $this->config->item('consumer_secret')
);
/** Perform a GET request and echo the response **/
/** Note: Set the GET field BEFORE calling buildOauth(); **/
$url = 'https://api.twitter.com/1.1/followers/ids.json';
$getfield = '?username=SaswatRoutroy';
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
echo $twitter->setGetfield($getfield)
->buildOauth($url, $requestMethod)
->performRequest();
问题是我希望显示个人资料图片的名称和 URL,但我得到以下信息:
{"ids":[],"next_cursor":0,"next_cursor_str":"0","previous_cursor":0,"previous_cursor_str":"0"}
现在可能是因为我没有粉丝,而且网址错误。但我想要适当的方式和网址。