【发布时间】:2014-12-04 07:27:08
【问题描述】:
我在使用 Twitter API 时遇到问题。我正在尝试关注特定用户,但 API 总是返回以下错误:
{"errors":[{"code":108,"message":"Cannot find specified user."}]}
我尝试过传递 user_id、screen_name 和两者,但我总是得到相同的结果,尽管我很确定我实际上传递了正确的值。
这是我正在使用的代码:
$options = array(
CURLOPT_HTTPHEADER => $header,
CURLOPT_HEADER => false,
CURLOPT_URL => $this->url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POSTFIELDS => $postfields,
CURLOPT_POST => true
);
$feed = curl_init();
curl_setopt_array($feed, $options);
$json = curl_exec($feed);
curl_close($feed);
其中 $postfields 是一个关联数组,其中包含 user_id 和要关注的用户的 id,或者 screen_naam 和屏幕名称。我从 Twitter API 获得了这两个值,所以它们应该是正确的。我也试过其他用户,结果是一样的。
APP 消费者 ID/密钥作为 oauth 令牌/秘密作为读/写和工作(如果我更改它们,我会收到身份验证错误)。
有什么想法吗?
【问题讨论】: