我试图使用Facebook的API来运行FQL查询。我在PHP中设置好一切这里是code的外观:
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/facebook.php"; $code = $_REQUEST["code"]; //auth user if(empty($code)) { $dialog_url = 'www.facebook/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 = 'graph.facebook/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);一切正常使用上述code,但最近我决定改变我的URL结构,而不是通过访问网页的 url/facebook.php 我想访问通过 url/#facebook 。
当我做了这个更改为$ my_url变量我收到以下错误。
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!
推荐答案我解决它在XAMPP加入扩展= php_openssl.dll 在 XAMPP /php/php.ini 文件。在XAMPP的某些版本中此行被注释掉像;延长= php_openssl.dll ,所以只是注释,并重新启动Apache。
I solved it in XAMPP by adding extension=php_openssl.dll in xampp/php/php.ini file. in some versions of XAMPP this line is commented like ;extension=php_openssl.dll, so just uncomment it and restart apache.
更多推荐
Facebook的API 400错误的请求
发布评论