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 6589259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:09:02+00:00 2026-05-25T17:09:02+00:00

this is my invitation code: <?php $app_id = 12345678910112; $canvas_page = http://apps.facebook.com/apppage/; $con =

  • 0

this is my invitation code:

<?php 
$app_id = "12345678910112";
$canvas_page = "http://apps.facebook.com/apppage/";       

$con = new mysqli("localhost","username","password","dbname") or die(mysqli_connect_error()); 
$SQL=mysqli_query($con,"select the already invited friends");

$exclude_ids="";

while($row = mysqli_fetch_assoc($SQL))
{
$exclude_ids=$exclude_ids . "," . $row['inviteduserid']  ; 
}

mysqli_free_result($SQL);
mysqli_close($con);
// now the $exclude_ids will look like this 12321324,54621321,465498631,23184641  

$message = "join this cool app";
$filters = array('app_non_users');
$requests_url = "https://www.facebook.com/dialog/apprequests?app_id=" . $app_id 
. "&redirect_uri=" . urlencode($canvas_page) 
. "&message=" . $message 
. "&filters=" . json_encode($filters) 
. "&max_recipients=25" 
. "&exclude_ids=" . $exclude_ids;

?>

every thing is working very well except it is not excluding the invited friends.
what is wrong with this?

  • 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-25T17:09:03+00:00Added an answer on May 25, 2026 at 5:09 pm

    thanks Lix,but i don’t know why is it still not working for me.
    anyway i had to make my way around, and since the exclude ids is not working bu the filter is perfectly does so i will use the filter parameter to only show the uninvited friends like this.

    <?php 
    
     //get the current user id.
    $signed_request = $_REQUEST["signed_request"];
    list($encoded_sig, $payload) = explode('.', $signed_request, 2); 
    $data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
    
    //get the already invited friends from the database based on $data["user_id"].
        $SQL = mysqli_query($con,"select the invited users ids from the DB"); 
         $exclude_ids = $data["user_id"]; //$data["user_id"] ia my facebook id i added it to the excluded ids because i will not use app_non_users in the filter
        while($row = mysqli_fetch_assoc($SQL))
        {
            $exclude_ids = $exclude_ids . "," . $row['invto']  ;
        }
        mysqli_free_result($SQL);
        mysqli_close($con);
    
    //get my friends.
    require("php-sdk/src/facebook.php");
         $facebook = new Facebook(array('appId'  => 'APP_ID','secret' => 'APP_SECRET','cookie' => true,));
    
        $fbme = $facebook->api('/me/friends');
        $datas = $fbme['data'];
    
     foreach($datas as $x)
     {
         $arymyfriends[] = $x['id'];
     }
    
     //compare my friends to the invited friends and get the unmatched.
     $aryexcluded = explode(",",$exclude_ids);
     $aryresults = array_diff($arymyfriends,$aryexcluded);
     $exclude_ids = implode(",",$aryresults );
    
    
     //show the invitation page
         $app_id = "12345678912358";
         $canvas_page = "http://apps.facebook.com/appname/";
         $message = "come join this cool app.";
         $filters = array(array('name' => 'Best friends','user_ids' => $exclude_ids));
         $requests_url = "https://www.facebook.com/dialog/apprequests?app_id=" . $app_id 
         . "&redirect_uri=" . urlencode($canvas_page) 
         . "&message=" . $message 
         . "&filters=" . json_encode($filters) 
         . "&max_recipients=25";
    
         if (empty($_REQUEST["request_ids"])) {
            echo("<script> top.location.href='" . $requests_url . "'</script>");
    
         }
    

    i know it is not the best solution but it works…

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

Sidebar

Related Questions

I have a site in PHP.In this when I send the invitation to people
This is (I think) related to eclipse helios for PHP - code formatter not
Consider the following scenario: http://www.restserver.com/example.php returns some content that I want to work with
UPDATE 2: The code I currentlly have is as follows: paypalplatform.php: https://www.paypal-labs.com/integrationwizard/adaptive/code2.php basic_payment.php: (the
In my current .NET and FBML-based facebook app, I have some code that looks
This code, obviously, redirects from where it is (in a 404 handler) to a
I have this code that performs an ajax call and loads the results into
I already searched the site and found this: GameCenter Invitation Handler He says: As
Since I moved a PHP app to a new server (PHP/5.3.8 running as Apache
I have the following code to allow users to invite thier Facebook friends: function

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.