Facebook图谱API错误

5
我正在使用Facebook Graph API来获取用户的详细信息,例如名字、电子邮件等。
以下是我的代码。
$nvpreq = "access_token=160370244010460|b8eba6c19f01b271ef0c682e-100000018108668|q50nk4_LpXvCdnpgiI-jyBPrzCM"; 

$Curl_Session = curl_init('https://graph.facebook.com/100001573561119');
curl_setopt ($Curl_Session, CURLOPT_POST, 1);
curl_setopt ($Curl_Session, CURLOPT_POSTFIELDS, $nvpreq);
curl_setopt ($Curl_Session, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$httpResponse = curl_exec ($Curl_Session);
curl_close ($Curl_Session); 

但我收到了以下错误:
"type":"GraphMethodException","message":"Unsupported post request."}}1 

有人能帮我吗。

谢谢, Atul


你能否把代码格式化一下,这样阅读起来会更容易些吗?谢谢。 - Bartek
1个回答

8
访问令牌应该使用GET方法传递,而不是POST。只需将其附加到您的URL中,它就可以正常工作!

1
谢谢,问题现在已解决。 - Atul

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接