Facebook的API 400错误的请求

编程入门 行业动态 更新时间:2024-10-28 20:18:18
本文介绍了Facebook的API 400错误的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图使用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加入扩展= p​​hp_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错误的请求

本文发布于:2023-10-12 02:33:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1483512.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   Facebook   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!