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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:56:41+00:00 2026-06-03T06:56:41+00:00

When I run the below code it seems to me curl_multi_select and curl_multi_info_read are

  • 0

When I run the below code it seems to me curl_multi_select and curl_multi_info_read are contradicting each other. As I understand it curl_multi_select is supposed to be blocking until curl_multi_exec has a response but I haven’t seen that actually happen.

$url = "http://google.com";
$ch  = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);

$mc = curl_multi_init();
curl_multi_add_handle($mc, $ch);

do {
  $exec = curl_multi_exec($mc, $running);
} while ($exec == CURLM_CALL_MULTI_PERFORM);

$ready=curl_multi_select($mc, 100);
var_dump($ready);

$info = curl_multi_info_read($mc,$msgs);
var_dump($info);

this returns

int 1
boolean false

which seems to contradict itself. How can it be ready and not have any messages?

The php version I’m using is 5.3.9

  • 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-03T06:56:43+00:00Added an answer on June 3, 2026 at 6:56 am

    Basically curl_multi_select blocks until there is something to read or send with curl_multi_exec. If you loop around curl_multi_exec without using curl_multi_select this will eat up 100% of a CPU core.
    So curl_multi_info_read is used to check if any transfer has ended (correctly or with an error).

    Code using the multi handle should follow the following pattern:

    do
    {
        $mrc = curl_multi_exec($this->mh, $active);
    }
    while ($mrc == CURLM_CALL_MULTI_PERFORM);
    
    while ($active && $mrc == CURLM_OK)
    {
        curl_multi_select($this->mh);
        do
        {
            $mrc = curl_multi_exec($this->mh, $active);
        }
        while ($mrc == CURLM_CALL_MULTI_PERFORM);
        while ($info = curl_multi_info_read($this->mh))
        {
            $this->process_ch($info);
        }
    }
    

    See also: Doing curl_multi_exec the right way.

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

Sidebar

Related Questions

When I run the below code, everything goes great until I change the value
I'm trying to run the below-mentioned code in VB(Excel Macro) but I'm stuck with
I am trying to run the code below but it keeps locking up my
the code below works fine but it takes an absolute age to run. How
Any ideas given the code below why the highlight is being triggered to run
When I run the following code, I get the exception below: ''# NOTE: ExcelApp
I'm doing a very simple Comet-like long polling in JavaScript The code below seems
When I run the code below the output is DelegateDisplayIt, typically repeated 1-4 times.
When I run the code below, a new User with the expected properties is
For a while now the installer for my program has used the below code

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.