im trying to test example from developers webpage
$token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . facebook::getConfig( 'appId' ) .
"&client_secret=" . facebook::getConfig( 'secret' ) .
"&grant_type=client_credentials";
$app_access_token = file_get_contents($token_url);
$user_id = "100002758712176";
$apprequest_url = "https://graph.facebook.com/".
$user_id .
"/apprequests?message='test string'&" .
$app_access_token . "&method=post";
$result = file_get_contents(urlencode($apprequest_url));
echo "App Request sent? ". $result;
and got eror [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
when i use $apprequest_url in browser all works . Where is the problem ?
First you should urlencode the string you are sending in url: