facebook, post comment via php curl -


From a tutorial here:

I later posted a comment Try a post, but return:

  [type] => OAuthException [Message] = & gt; (# 200) The user has not authorized the app to perform this action.   

This is not my post antivont wall post ID, I tried my freinds wall, he My app has allowed, I can post a post to my post, but failed in a comment, I would like to https://graph.facebook.com/<his fid> / Feed? Post ID was found through Access_token = 140XXXXXXXXXXX , so there is no problem in post id.

What steps have I taken?

  $ fbId = '100001102789652_233997699980321'; $ AccessToken = '140XXXXXXXXXXXXX' '; $ Url = "https://graph.facebook.com/{$fbId}/comments"; $ Attachments = array ('access_token' = & gt; $ accessToken, 'message' = & gt; "hi comment",); // Set 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);   

? & Gt;

  curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ attachment);   

should be

  curl_setopt ($ ch, CURLOPT_POSTFIELDS, http_build_query ($ attachment));   

Because you can not post an array

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -