php - Facebook fb:request-form not working


I just tried using the example given on to open a request form and invite friends, so I changed everything accordingly but nothing happens, do I need to launch it in some way?

$api_key = '...';
$secret  = '...';
require_once 'facebook.php';

// Names and links
$app_name = "...";
$app_url = ""; // Assumes application is at
$invite_href = "invite.php"; // Rename this as needed

$user2 = $facebook->require_login();

if(isset($_POST["ids"])) {
    echo "<center>Thank you for inviting ".sizeof($_POST["ids"])." of your friends on <b><a href=\"".$app_url."/\">".$app_name."</a></b>.<br><br>\n";
    echo "<h2><a href=\"".$app_url."/\">Click here to return to ".$app_name."</a>.</h2></center>";
} else {
    // Retrieve array of friends who've already authorized the app.
    $fql = 'SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1='.$user2.') AND is_app_user = 1';
    $_friends = $facebook->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=\"".$user2."\" firstnameonly=\"true\" shownetwork=\"false\"/> has started using <a href=\"".$app_url."/\">".$app_name."</a> and thought it's so cool even you should try it out!\n".
        "<fb:req-choice url=\"".$facebook->get_add_url()."\" label=\"Put ".$app_name." on your profile\"/>";

    action="<? echo $invite_href; ?>"
    type="<? echo $app_name; ?>"
    content="<? echo htmlentities($content,ENT_COMPAT,'UTF-8'); ?>">

        actiontext="Here are your friends who don't have <? echo $app_name; ?> yet. Invite whoever you want -it's free!"
        exclude_ids="<? echo $friends; ?>" />





hello the following code works for me

<fb:serverFbml width="760px">
  <script type="text/fbml">
            type='photo fun'
            content="Let's fun with facebook
        <fb:req-choice url='' label='Register'/>"
        <fb:multi-friend-selector actiontext="Select your friends."></fb:multi-friend-selector>

People are also looking for solutions to the problem: php - admin generator doesn't generate a class


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.