我在PHP中使用fabrook连接代码,如
$facebook = new Facebook(array( 'appId' => FACEBOOK_APP_ID, 'secret' => FACEBOOK_SECRET, 'cookie' => true));
$session = $facebook->getSession();
$loginUrl = $facebook->getLoginUrl(
array(
'canvas' => 1,
'fbconnect' => 0,
'req_perms' => 'email,read_stream,publish_stream,offline_access',
'next' => 'http://apps.facebook.com/appname/')
);
if (!$session) {
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
当用户访问我的应用程序时,它会重定向到facebook权限页面。该用户必须点击允许才能接受权限请求。
当用户允许时,我的应用程序返回sime会混淆URL,例如
http://apps.facebook.com/appname/?perms=email%2Cread_stream%2Cpublish_stream%2Coffline_access&selected_profiles=1756044141&installed=1&session= {%22session_key%22%d221b6f2-1756044141%22%2C%22uid%22%3A%221756044141%22%2C%22expires%22%3A0%2C%22secret%22%5ffd193f40cc1c3acd%22% 2C%22base_domain%22%3A%22muslimsquare.com%22%2C%22access_token%22%3A%22148835711801079 | bdf70ed30-1756044141 |。wvq6bAErEPdDxMZ%22%2C%22sig%22%3A%22478a31ffc9dcc55daa19aa0d72}
而不是
如何将其修复为facebook return clean url(http://apps.facebook.com/appname/)
答案 0 :(得分:0)
这是因为facebook默认会将会话,应用程序ID和更多信息添加到网址。但是,您可以像这样解码网址:
urldecode($url);