开发者

why connect facebook app return confuse URL

I have fabrook connect code in PHP like

$facebook = new Facebook(array( 'appId'  => FACEBOOK_APP_ID, 'secret' =>开发者_JAVA百科 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;
    }

when user access too my application it redirect to facebook permission page. that user must click Allow to accept permission request.

when user Allow, my application return sime confuse URL such as

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}

instead of

http://apps.facebook.com/appname/

how can i fix it to facebook return clean url (http://apps.facebook.com/appname/)


That is because facebook adds session, application id and more information to the url by default. You can however, decode the url like this:

urldecode($url);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜