Facebook 申请请求
我正在尝试在页面选项卡应用程序中实现 facebook 请求。我在这里看到了教程 http://developers.facebook.com/docs/appsonfacebook/tutorial/ 但问题是我希望只有当有人访问链接时才执行下面的代码,就像
<a href = "something">Send to friends</a>
任何关于如何做到这一点的想法一样?谢谢!
$requests_url = "http://www.facebook.com/dialog/apprequests?app_id="
. $app_id . "&redirect_uri=" . urlencode($the_url_of_the_tab_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"]);
}
i am trying to implement a facebook request in a page tab application. i have seen the tutorial here http://developers.facebook.com/docs/appsonfacebook/tutorial/ but the problem is that i want the code below to be executed only when someone accesses a link like
<a href = "something">Send to friends</a>
any idea about how can this be done? thanks!
$requests_url = "http://www.facebook.com/dialog/apprequests?app_id="
. $app_id . "&redirect_uri=" . urlencode($the_url_of_the_tab_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"]);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请求对话框就是您正在寻找的:
所以您的“链接”应该不是调用真实的 URL,而是调用 Javascript 函数来打开请求对话框(在上面的示例中,它将是
sendRequestViaMultiFriendSelector()
)。The request dialog is what you are looking for:
So your "link" shouldn't be calling a real url but instead a Javascript function to open the Request Dialog (in the above example it'll be
sendRequestViaMultiFriendSelector()
).