D'un tutoriels ici:facebook, poster un commentaire via curl php
Post a reply on a comment in Facebook using cURL PHP/Graph API
J'ai essayé de poster un commentaire à après un poste, mais retour:
[type] => OAuthException [message] => (#200) The user hasn't authorized the application to perform this action
Ce n'est pas mon application acount ID poste de mur, j'ai essayé de mon mur freinds, il a permis mon application, je peux poster un message à son mur, mais a échoué dans un commentaire, j'ai reçu l'ID poste via https://graph.facebook.com/<his fid>/feed?access_token=140XXXXXXXXXXX
, de sorte que l'ID de la poste n'a pas de problème.
Quelles étapes ai-je manqué?
$fbId = '100001102789652_233997699980321';
$accessToken = '140XXXXXXXXXXXX';
$url = "https://graph.facebook.com/{$fbId}/comments";
$attachment = array(
'access_token' => $accessToken,
'message' => "Hi comment",
);
// set the target url
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$comment = curl_exec($ch);
curl_close ($ch);
$comment = json_decode($comment, TRUE);
print_r($comment);
?>
merci pour une réponse, mais toujours retuen le même avertissement mauvais. – cj333
oui, access_token est faux – genesis
vous avez raison, devrait mettre un plus long access_token. Je suis perplexe, quand je poste un message sur le mur des amis, seulement besoin d'un access_token court, mais un commentaire a besoin d'un access_token plus long. – cj333