Reputation: 1910
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["request_ids"]);
}
?>
but after sending the invitations the page keeps refreshing in like infinit loop
what is wrong with that?
Upvotes: 0
Views: 1351
Reputation: 1631
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:
$requests_url
).$canvas_page
).$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.
Upvotes: 1