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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:27:40+00:00 2026-06-15T04:27:40+00:00

I am using the Facebook php sdk v3.2.0, and am only getting an empty

  • 0

I am using the Facebook php sdk v3.2.0, and am only getting an empty data set returned when searching for posts using an AND query like: watermelon+banana. I am currently running this script from the commandline, if that makes any difference:

$facebook = new Facebook(array(
 'appId' => 'MY_APP_ID',
 'secret' => 'MY_SECRET',
));

$q = "watermelon+banana" ;

$search = $facebook->api('/search?q='.$q.'&type=post&limit=10');

foreach ($search as $key=>$value) {
  foreach ($value as $fkey=>$fvalue) {
    print_r ($fvalue);
 }
}

when just going to http://graph.facebook.com/search?q=watermelon+banana&type=post in my browser, I can see the results. Also, when querying $q=”watermelon” it does work. I’ve tried this on different machines but also no dice. Does anyone know what’s going on?

  • 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-06-15T04:27:41+00:00Added an answer on June 15, 2026 at 4:27 am

    You are encoding + when you don’t need to do so.

    So your query in PHP is actually http://graph.facebook.com/search?q=watermelon%2Bbanana&type=post&limit=10

    leave out the urlencode function

    $q = "watermelon+banana" ;
    
    $search = $facebook->api('/search?q='.$q.'&type=post&limit=10');
    

    So the full code looks like

    <?php
    
    require 'facebook.php';
    
    $facebook = new Facebook(array(
        'appId' => 'YOUR_APP_ID',
        'secret' => 'YOUR_SECRET',
    ));
    
    $q = "watermelon+banana" ;
    
    $search = $facebook->api('/search?q='.$q.'&type=post&limit=10');
    
    foreach ($search as $key=>$value) {
        foreach ($value as $fkey=>$fvalue) {
            print_r ($fvalue);
        }
    }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Facebook php sdk to try to get posts of a users
Using the Facebook PHP SDK, I'm getting the following error when I try to
I am using facebook PHP SDK. After the user allows my application, facebook redirects
I'm using the Facebook PHP-SDK to sign in users and it works fine. I'm
I'm using the facebook graph PHP sdk - whenever I call the $facebook->api method
Using the PHP sdk I'm signing users into my site with Facebook log in.
I am using php-sdk for showing facebook information of the user. I have successfully
I am integration Facebook connect in my website using php SDK.. Everything is working
I am using the PHP library for the Graph API ( http://github.com/facebook/php-sdk ) but
I am migrating my Facebook canvas application to using the new PHP SDK. However,

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.