I want to send app request to user of app Facebook.
https://graph.facebook.com/myid_facebook/apprequests?message=test&data=INSERT_STRING_DATA&access_token=XXXXXXX&method=post
I’ve tried using curl, but it’s not to work …
This is my source code
$app_id = 'XXXXXXXXXX';
$app_secret = 'XXXXXXXXXXXXXXX';
$apprequest_url = "https://graph.facebook.com/endif.tc" .
"/apprequests?message=’pak nurrohman memberi anda tugas’" .
"&data=’INSERT_STRING_DATA’&access_token=" .
$this->facebook->getAccessToken() . "&method=post";
$result = file_get_html($apprequest_url);
echo ("Request id number: " . $result['request']);
file_get_html is function to load another page using curl.
and this error is:
"failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request"
I want to execute this graph on php side..is there any solution for me?
I’m sorry, my bad english.:)
I believe this is because of the url and the fact you cant just method=post.
Use This Code Instead For A Proper URL
The other issue may be that file_get_contents does not POST the data to the page. If you wish to post the data you might need to use the cURL library.