邀请好友,facebook应用开发,卡在最后阶段,使用php-sdk
我正在尝试开发一个facebook应用程序,最后一步尚未完成,即邀请朋友玩该应用程序。我尝试以下代码,但出现错误。请建议如何进行。谢谢!
从index.php我调用invite.php,其编写如下,我已经能够在用户墙上发表评论。
invite.php
<?php
$app_id = '************';
$canvas_page = '127.0.0.1/****/';
$message = "Would you like to join me in this great app?";
$requests_url = "http://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"]);
}
?>
I am trying to develop a facebook application, the last step is unfinished, that of inviting friends to play the app. i try the following code, but i am getting error. Please suggest how to go about. Thanks!
From index.php i am calling invite.php which is written as follows, i am already able to post comments on user's wall.
invite.php
<?php
$app_id = '************';
$canvas_page = '127.0.0.1/****/';
$message = "Would you like to join me in this great app?";
$requests_url = "http://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"]);
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现使用最近发布的请求对话框更容易。它使用 javascript SDK,而不是 OpenGraph URL 方法。
http://developers.facebook.com/docs/reference/dialogs/requests/
I found it easier to just use the request dialog, which was recently released. It uses the javascript SDK, not the OpenGraph URL method.
http://developers.facebook.com/docs/reference/dialogs/requests/