您可以按如下方式执行此操作:首先,您将 50 个朋友 id 设置为参数,并在您发送请求时将剩余的朋友 id 存储在 cookie 中,然后它重定向到您的网站 url,您可以在其中重复上述步骤。即发送 50 个朋友请求并存储剩余在饼干里。
var to="";
for(var j=0 ; j< 50 && j<friends.length ; j++){
if(friends[j].checked == true){
to += friends[j].value;
if(j != friends.length-1 && j != 49){
to += ',';
}
}
}
var redirect_uri=your_site_url+"?button=inviteresponse";
var callbackto="";
for(var i=j;i<friends.length;i++){
callbackto += friends[i].value;
if(i != friends.length-1){
callbackto += ',';
}
}
document.cookie = "param="+callbackto+";path=/";
var url="https://www.facebook.com/dialog/apprequests?app_id="+app_id+"&to="+to+"&message=Checkout apps&redirect_uri="+redirect_uri;
window.open(url,'', 'width=900,height=500,resizable=yes,scrollbars=yes');
case "inviteresponse":
if (empty($_COOKIE['param'])) {
unset($_COOKIE['param']);
echo "<script type='text/javascript'>window.close();</script>";
die();
} else {
$friends = explode(",", $_COOKIE["param"]);
$to = "";
for ($j = 0; $j < 50 && $j < count($friends); $j++) {
$to .= $friends[$j];
if ($j != count($friends) - 1 && $j != 49) {
$to .= ",";
}
}
$redirect_uri = your_site_url+"?button=inviteresponse";
$callbackto = "";
for ($i = $j; $i < count($friends); $i++) {
$callbackto .= $friends[$i];
if ($i != count($friends) - 1) {
$callbackto .= ",";
}
}
unset($_COOKIE['param']);
setcookie("param", $callbackto);
$url = "https://www.facebook.com/dialog/apprequests?app_id=" . APP_ID . "&to=" . $to . "&message=Checkout apps&redirect_uri=" . $redirect_uri;
header("Location: " . $url);
}