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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:59:26+00:00 2026-05-23T08:59:26+00:00

<?php include ‘includes/config.php’; function do_curl($start_index, $stop_index) { // Do query here to get all

  • 0
<?php
include 'includes/config.php';

function do_curl($start_index, $stop_index) {

    // Do query here to get all pages with ids between start index and stop index

    $query = "SELECT * FROM fanpages WHERE idnum >= $start_index and idnum <= $stop_index";
    $result = mysql_query($query) or die(mysql_error());
    while ($row = mysql_fetch_array($result))
    {
        $fanpages_query[] = 'http://graph.facebook.com/'.$row['page_id'];
    }
    return $fanpages_query;   
}

$fanpages = do_curl($_GET['start_index'], $_GET['stop_index']);
$fanpages_count = count($fanpages);

$curl_arr = array();
$master = curl_multi_init();

for($i = 0; $i < $fanpages_count; $i++)
{
    $url = $fanpages[$i];
    $curl_arr[$i] = curl_init($url);
    curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true);
    curl_multi_add_handle($master, $curl_arr[$i]);
}
do {
    curl_multi_exec($master,$running);
} while($running > 0);

echo "results: <br>";
for($i = 0; $i < $fanpages_count; $i++)
{
    $results = json_decode(curl_multi_getcontent($curl_arr[$i]));
    echo("Page Name: ".($results->name)."<br>"."Likes: ".($results->likes)."<br>"."ID: ".($results->id)."<br><br>");
}
echo 'done';


?>

And like you can see almost everything works, the only problem is with the Array’s, I asked a question related to this like two hours ago but the answer that I got doesn’t work for me. So the problem is that the combination of do_curl and the while in it with $fanpages arrays list is not working. every time I’m trying to run the script i get the proper number of pages, proper number of data but it throws me this error:

Notice: Trying to get property of non-object in C:\xampp\htdocs\curltest.php on line 46

Notice: Trying to get property of non-object in C:\xampp\htdocs\curltest.php on line 46

Notice: Trying to get property of non-object in C:\xampp\htdocs\curltest.php on line 46

My bet is that the arrays aren’t parsed like they need to be | $fanpages = array(‘http://graph.facebook.com/1111111&#8217;, ‘http://graph.facebook.com/222222222&#8217;, ‘http://graph.facebook.com/333333333&#8217;); | because if I write them manually everything works.

EDIT: There was a script error on:

 $fanpages_query[] = '\'http://graph.facebook.com/'.$row['page_id']."'";

and i just removed the \’ and now its throwing:

Notice: Undefined property: stdClass::$name in C:\xampp\htdocs\curltest.php on line 48

After adding var_dump:

object(stdClass)#1 (1) { ["error"]=> object(stdClass)#2 (2) { ["type"]=> string(20) "GraphMethodException" ["message"]=> string(24) "Unsupported get request." } } string(78) "{"error":{"type":"GraphMethodException","message":"Unsupported get request."}}" NULL
Notice: Undefined property: stdClass::$name in C:\xampp\htdocs\curltest.php on line 48
  • 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-23T08:59:26+00:00Added an answer on May 23, 2026 at 8:59 am
    $results = json_decode(curl_multi_getcontent($curl_arr[$i]));
    

    The JSON decoding is failing. Change it to this and post the results so we can get some more info:

    $results = json_decode($raw_results = curl_multi_getcontent($curl_arr[$i]));
    var_dump($results, $raw_results, !$results?json_last_error():null);
    

    EDIT 1

    According to the comments you aren’t getting any data back. Is there a reason you aren’t using code like that which is provided in the curl_multi_exec() manual page?

    $active = null;
    //execute the handles
    do {
        $mrc = curl_multi_exec($mh, $active);
    } while ($mrc == CURLM_CALL_MULTI_PERFORM);
    
    while ($active && $mrc == CURLM_OK) {
        if (curl_multi_select($mh) != -1) {
            do {
                $mrc = curl_multi_exec($mh, $active);
            } while ($mrc == CURLM_CALL_MULTI_PERFORM);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php include('includes/config.php'); $topi = $_GET['id']; //id of url mysql_select_db(ban, $con); $query = SELECT *
here is my code for json php include(connect.php); $id = $_GET['lid']; function countRec($fname,$tname) {
I get the following error messages: Warning: include_once(Zend\Db.php) [function.include-once]: failed to open stream: No
I can set the PHP include path in the php.ini : include_path = /path/to/site/includes/
When using the php include function the include is succesfully executed, but it is
When i use php include to include a page in my website all the
What am I doing wrong here folks? <?php include 'header.php'; /** * Display a
I have a problem with include pages in PHP. Picture shows what I want
I have the two following files: main.php include(functions.php) __EXTRACT(); echo $testvar; functions.php function __EXTRACT(){
The problem: I want to use PHP include to import file header_menu.html into all

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.