开发者

why is my facebook application keeps refreshing after sending invitations?

开发者 https://www.devze.com 2023-04-04 20:45 出处:网络
i\'m using this code to invite friends to my facebook application <?php $app_id = \"12165444444444444\";

i'm using this code to invite friends to my facebook application

<?php 

     $app_id = "12165444444444444";

     $canvas_page = "http://www.domain.net/facebook/app/";

     $message = "Would you like to join me in this great app?";

     $requests_url = "https://www.facebook.com/dialog/apprequests?app_id=" 
            . $app_id . "&redirect_uri=" . urlencode($canvas_page)
            . "&message=" . $message;

     if (empty($_REQUEST["request_ids"])) {
        echo("<script> top.location.href='" . $requests_url . "'</script>");
     } else {
        echo "Request Ids: ";
        print_r($_REQUEST开发者_JS百科["request_ids"]);
     }

?>

but after sending the invitations the page keeps refreshing in like infinit loop

what is wrong with that?


Since the request_ids parameter will only be added to the URL if the user has just accepted an application request, the following will happen:

  1. A user visits the page, and then is redirected to a request dialog ($requests_url).
  2. The user either invites friends or cancels the dialog. They are redirected back to your application's canvas page ($canvas_page).
  3. Since $canvas_page does not contain the request_ids parameter, the user is redirected to a request dialog (see #1).

Without testing, I suspect that since a requests dialog was just created (and closed), Facebook is automatically redirecting to the redirect_uri, thus causing infinite redirects.

0

精彩评论

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