php - Posting status via Facebook's graph api -


In PHP, I am trying to post a post to use my Facebook fan page to use graph API, , The following code does not seem to update the status.

Here's the code;

  $ xPost ['access_token'] = "{key}"; $ X post ['message'] = "posting message test."; $ Ch = curl_init ('https://graph.facebook.com/ {page_id} / feeds'); 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, $ x post); 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_xac ($ CH); Do anyone know why this code is not working? Access_token is correct.   

  $ url = "https://graph.facebook.com/ID_HERE/feed" ; $ Ch = curl_init (); $ Attachment = array ('access_token' = & gt; 'your token', 'name' = & gt; "title", 'link' = & gt; "www.google.com", 'description' = & gt; 'Description here',); 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); $ Result = curl_xac ($ CH); Curl_close ($ ch);  

Comments