Posting status via Facebook's graph api
Posted
by Simon R
on Stack Overflow
See other posts from Stack Overflow
or by Simon R
Published on 2010-05-17T16:16:38Z
Indexed on
2010/05/17
16:21 UTC
Read the original article
Hit count: 314
In PHP, I am trying to post a status to our Facebook fan page using the graph api, despite following the intructions facebook give, the following code does not seem to update the status.
Here is the code;
$xPost['access_token'] = "{key}";
$xPost['message'] = "Posting a message test.";
$ch = curl_init('https://graph.facebook.com/{page_id}/feed');
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xPost);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_CAINFO, NULL);
curl_setopt($ch, CURLOPT_CAPATH, NULL);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
$result = curl_exec($ch);
Does anyone know why this code is not working? The access_token is correct.
© Stack Overflow or respective owner