当我使用serverfbml标记在iframe应用程序中呈现facebook多朋友输入时,它会创建另一个加载小部件的iframe。那么,我无法从javascript或php获取用户输入的用户ID?
有人可以告诉我如何获得此ID吗?
提前致谢。
答案 0 :(得分:0)
这是我的invite.php,对我有用:
<?php
require_once "iframe-header.php";
if( !$fb_userid ) {
$api->require_frame();
}
$invite_href = $serverurl.'invite.php?'.$parms; // Rename this as needed
if(isset($_REQUEST["ids"])) {
echo '<center>Thank you for inviting '.sizeof($_REQUEST["ids"]).' of your friends on <b><a href="'.$appurl.'?'.$parms.'" target="canvas_iframe">'.$app_name.'</a></b>.<br/><br/>';
echo '<h2><a href="'.$appurl.'?'.$parms.'" target="canvas_iframe">Click here to return to '.$app_name.'</a>.</h2></center>';
} else if( $fb_userid ) {
// Retrieve array of friends who've already authorized the app.
$fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$fb_userid.') AND is_app_user = 1';
$_friends = $api->api_client->fql_query($fql);
// Extract the user ID's returned in the FQL request into a new array.
$friends = array();
if (is_array($_friends) && count($_friends)) {
foreach ($_friends as $friend) {
$friends[] = $friend['uid'];
}
}
// Convert the array of friends into a comma-delimeted string.
$friends = implode(',', $friends);
// Prepare the invitation text that all invited users will receive.
$content = '<fb:name uid="'.$fb_userid.'" firstnameonly="true" shownetwork="false" /> has started using <a href="'.$appurl.'">'.$app_name.'</a> and thought it's so cool even you should try it out! <fb:req-choice url="'.$api->get_add_url().'" label="Put '.$app_name.' on your profile" />';
echo '<fb:serverFbml style="width: 755px;"><script type="text/fbml"><fb:fbml><fb:request-form action="'.$invite_href.'" method="get" type="'.$app_name.'" content="'.htmlentities($content,ENT_COMPAT,'UTF-8').'">';
echo ' <fb:multi-friend-selector actiontext="Here are your friends who don't have '.$app_name.' yet. Invite whoever you want -it's free!" exclude_ids="'.$friends.'" />';
echo '</fb:request-form></fb:fbml></script></fb:serverFbml>';
}
require_once "iframe-footer.php";
&GT?;