Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API ERROR

I am implementing facebook graph api to get the user details such as firstname, email etc.

below is my code.

$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); 

But i receive below error

"type":"GraphMethodException","message":"Unsupported post request."}}1 

Can anyone please help me out.

Thanks, Atul

like image 635
Atul Avatar asked Jan 20 '11 19:01

Atul


1 Answers

The access token should be passed using the GET method, not POST. Just append it to your URL and it should work fine!

like image 104
Bartek Avatar answered Oct 02 '22 00:10

Bartek