Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6537775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:39:26+00:00 2026-05-25T10:39:26+00:00

i created a facebook app name bitsutopia, i wanted to invite my friends to

  • 0

i created a facebook app name bitsutopia, i wanted to invite my friends to that app using php.
i am using iframe in that app. i got this code from http://developers.facebook.com/docs/reference/fbml/request-form/ php script to show invite friends box. but it is not working. code –

<?php

    // Get these from http://developers.facebook.com
    $api_key = 'xxxx';
    $secret  = 'xxxx';

    // Names and links
    $app_name = "Bitsutopia";
    $app_url = "https://apps.facebook.com/bitsutopia/";
    $invite_href = "fb.php";

    require_once 'facebook.php';

    $facebook = new Facebook($api_key, $secret);
    $facebook->require_frame();
    $user = $facebook->require_login();

    if(isset($_POST["ids"])) {
        echo "<center>Thank you for inviting ".sizeof($_POST["ids"])." of your friends on <b><a href=\"http://apps.facebook.com/".$app_url."/\">".$app_name."</a></b>.<br><br>\n";
        echo "<h2><a href=\"http://apps.facebook.com/".$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='.$user.') 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=\"".$user."\" firstnameonly=\"true\" shownetwork=\"false\"/> has started using <a href=\"http://apps.facebook.com/".$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\"/>";

?>
<fb:serverfbml style="width: 650px;"> 
     <script type="text/fbml">
        <fb:fbml>
    <fb:request-form
        action="<?php echo $invite_href; ?>"
        method="post"
        type="<?php echo $app_name; ?>"
        content="<?php echo htmlentities($content,ENT_COMPAT,'UTF-8'); ?>">

        <fb:multi-friend-selector
            actiontext="Here are your friends who don't have <?php echo $app_name; ?> yet. Invite whoever you want -it's free!"
            exclude_ids="<?php echo $friends; ?>" />
    </fb:request-form> 
        </fb:fbml>
    </script> 
</fb:serverfbml>
<?php
     }
?>
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
    FB_RequireFeatures(
         ["CanvasUtil"],
         function(){
             FB.XdComm.Server.init('/xd_receiver.html');
             FB.CanvasClient.startTimerToSizeToContent();
         }
    );
</script>

<script type="text/javascript">
    FB_RequireFeatures(["XFBML"], function(){ FB.Facebook.init("Your Facebook API Key", "/xd_receiver.html"); });   
</script>

the invite box is not appearing in the app page. anything wrong in this one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:39:27+00:00Added an answer on May 25, 2026 at 10:39 am

    fmbl does not work with iframe apps with my experiance

    We are in the process of deprecating FBML. If you are building a new
    application on Facebook.com, please implement your application using
    HTML, JavaScript and CSS. You can use our JavaScript SDK and Social
    Plugins to embedded many of the same social features available in
    FBML. While there is still functionality that we have not ported over
    yet, we are no longer adding new features to FBML.
    as quoted from http://developers.facebook.com/docs/reference/fbml/

    I use either

     $requests_url = "http://www.facebook.com/dialog/apprequests?app_id=" 
            . $app_id . "&redirect_uri=" . urlencode($canvas_page)
            . "&message=" . $message;
    
        echo("<script> top.location.href='" . $requests_url . "'</script>");
    

    or with the java sdk

    <script src="http://connect.facebook.net/tr_TR/all.js" type="text/javascript"></script>
        <a href="#" onClick="FB.ui({method: 'apprequests', message: 'Here is your invite msg.', data: '', filters: ['all'], exclude_ids: ['ids,you,want,to,exclude']},
        function(response) {if(response != null) {window.location='?requests='+response.request_ids;}});">Send Requests</a>
    

    this one i like better 🙂 but its harder to get your head around

    <script src="http://connect.facebook.net/tr_TR/all.js" type="text/javascript"></script>
        <a href="#" onClick="FB.ui({method: 'apprequests', message: 'Here is your invite msg.', data: '', filters: ['all'], exclude_ids: ['ids,you,want,to,exclude']}});">Send Requests</a>
    

    without the redirect if you are not worried about who they invited

    sorry about the horrible copy and paste coding.. was rushing

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a facebook app and i configured the following: IFrame Size: Resizable Canvas
I created a Facebook canvas app. I tried using the app as a user.
I created an APP on Facebook and using graph API explorer, I selected my
I have created a simple Facebook application in PHP, that greets user by there
I'm creating a mvc3 canvas app using facebook c# sdk The method name is
I created a facebook app and the login loads but once it does that
I have created a Facebook app that is accessible at https://apps.facebook.com/12345678 , but I
I created an app on Facebook. Thanks to this app, the users can publish
I have created a Facebook app, added it to a Facebook Fan page and
I have created a Facebook App and a Facebook Page for a company. What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.