我真的很难理解这里发生了什么。我可以在 OpenGraph 测试器中很好地获取用户详细信息,或者只是点击 URL https://graph.facebook.com/me?access_token=VALID_TOKEN或使用 file_get_contents,但是在尝试 Codeigniter Facebook 库时出现错误“活动访问令牌必须使用...”,如果我只是尝试 CURL GET,我不会得到任何输出。我知道 access_token 是有效的,为什么他们不工作?总体目标是从 iOS App 获取 access_token,并使用 og.likes 通过 Web 服务器使用它来进行 Like。
我的测试功能:
function me_test(){
$access_token = "VALID_TOKEN";
$url = 'https://graph.facebook.com/me?access_token=';
$url_full = $url.$access_token;
$result = file_get_contents($url_full);
echo $result;
// Try Codeigniter Facebook Library
try {
$user = $this->facebook->api('/me?access_token='.$access_token);
} catch (Exception $e) {
print_r($e);
}
// Codeigniter CURL Library
$this->load->library('curl');
echo $this->curl->simple_get($url_full);
$info = $this->curl->info;
print_r($info);
}