I'm trying to use the Facebook api to run an fql query. I set everything up in PHP here is how the code looks:
$app_id = 'APP_ID';
$app_secret = 'APP_secret';
$my_url = "url.com/facebook.php";
$code = $_REQUEST["code"];
//auth user
if(empty($code)) {
$dialog_url = 'https://www.facebook.com/dialog/oauth?client_id='
. $app_id . '&redirect_uri=' . urlencode($my_url) ;
echo("<script>top.location.href='" . $dialog_url . "'</script>");
}
//get user access_token
$token_url = 'https://graph.facebook.com/oauth/access_token?client_id='
. $app_id . '&redirect_uri=' . urlencode($my_url)
. '&client_secret=' . $app_secret
. '&code=' . $code;
$access_token = file_get_contents($token_url);
// Run fql query
$fql_query_url = 'FQL_Query';
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
Everything worked fine using the code above, but recently I decided to change my URL structure and instead of accessing the page via url.com/facebook.php I would like to access it via url.com/#facebook.
When I made this change to the $my_url variable I received the following errors.
[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request
Any ideas? Thanks!