Facebook的图形API/PHP SDK登录问题
无法打开我的应用程序, 我是一个新手,以Facebook应用程序开发 我只是想获取登录用户的用户名,并显示它 但我无法登录,我总是得到错误信息Facebook的图形API/PHP SDK登录问题
这是简单的代码复制了developer.facebook.com
我也试过指定的权限和重定向URL,但还是没有用 请大家帮帮忙它,我已经卡住过去两天
here针对PHP页面的代码
<?
// Remember to copy files from the SDK's src/ directory to a
// directory in your application on the server, such as php-sdk/
require_once('src/facebook.php');
config = array(
'appId' => '***',
'secret' => '***',
);
$facebook = new Facebook($config);
$user_id = $facebook->getUser();
?>
<html>
<head></head>
<body>
<?
if($user_id) {
// We have a user ID, so probably a logged in user.
// If not, we'll get an exception, which we handle below.
try {
$user_profile = $facebook->api('/me','GET');
echo "Name: " . $user_profile['name'];
} catch(FacebookApiException $e) {
// If the user is logged out, you can have a
// user ID even though the access token is invalid.
// In this case, we'll get an exception, so we'll
// just ask the user to login again here.
$standalone_url = 'http://localhost/trial/';
$login_url = $facebook->getLoginUrl(array(
'next' => $standalone_url.'next.php',
'redirect_uri' => $standalone_url.'message.php',
'scope' => 'user_about_me'));
echo 'Please <a href="' . $login_url . '">login.</a>';
error_log($e->getType());
error_log($e->getMessage());
}
} else {
// No user, print a link for the user to login
$login_url = $facebook->getLoginUrl();
echo 'Please <a href="' . $login_url . '">login.</a>';
}
?>
</body>
</html>
我试图/已
一)清除所有Web缓存ñ历史(网络浏览器:Firefox)
B)也被删除Java applet和应用程序缓存
请参见网址 图像,以获得更多清晰的图片
在图像大家分享您的重定向URI是:http://localhost/trial/index.php
不配置中的面板搭配你的画布URI:https://developers.facebook.com/apps
所以,解决办法是:您的重定向必须完全与canvas url
甚至匹配斜线:
http://my_app.com/
请告诉我去哪里 我对Facebook应用程序开发完全陌生,不知道从哪里开始,developer.facebook不会帮助反正 1)我工作在PHP 2)我想开发将在画布上 3运行)一个应用程序,请告诉/引导每个n每个进程与正确的OAuth 2.0发展与PHP不FQL,原因我读到它没有太大的用处或其他 – 2012-02-23 16:46:54
可能,这将帮助你: http://www.krizna.com/general/login-with-facebook-using-php/
或者你可以试试这个。它使用PHP SDK v 4.0: http://www.phpgang.com/how-to-login-with-facebook-using-sdk-4-in-php_661.html
我强烈建议立即通过开发人员应用程序更改您的密钥因为您发布的内容将保留在修订历史中)! – 2012-02-22 10:25:35
好吧,我删除了facebook应用程序 请告诉我现在如何为我的页面创建一个登录名 – 2012-02-22 12:42:24