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

  • Home
  • SEARCH
  • 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

I have this PHP include file that has all the variables I'll be using.
vars.php <?php $sometext=text; ?> index.php <?php include ('file1.php'); include ('variables.php'); function genStr() { $len
on Control page: <?php include 'pages/db.php'; $results = mysql_query(SELECT * FROM sidemenu WHERE `menu_id`='.$menu.'
I need to include a php file to one of my file. I have
I'm using a very simple PHP include to grab my current twitter status and
I've built my site with php include and the index is as follows: Menu.php
I have a script called 'sess-start.php' which lies in an /include directory within my
how do i style the html contents inside a php include file, using css?
In the main content area of a wordpress page I'm using a php include
I have a set of variables that are set outside the target php include

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.