No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

curl_multi_info_read

(PHP 5, PHP 7)

curl_multi_info_readGet information about the current transfers

Description

curl_multi_info_read ( resource $mh [, int &$msgs_in_queue = NULL ] ) : array

Ask the multi handle if there are any messages or information from the individual transfers. Messages may include information such as an error code from the transfer or just the fact that a transfer is completed.

Repeated calls to this function will return a new result each time, until a FALSE is returned as a signal that there is no more to get at this point. The integer pointed to with msgs_in_queue will contain the number of remaining messages after this function was called.

Warning

The data the returned resource points to will not survive calling curl_multi_remove_handle().

PHP: curl_multi_info_read - Manual Home of Manuel PHP  Contents Haut

Parameters

mh

A cURL multi handle returned by curl_multi_init().

msgs_in_queue

Number of messages that are still in the queue

PHP: curl_multi_info_read - Manual Home of Manuel PHP  Contents Haut

Return Values

On success, returns an associative array for the message, FALSE on failure.

Contents of the returned array
Key: Value:
msg The CURLMSG_DONE constant. Other return values are currently not available.
result One of the CURLE_* constants. If everything is OK, the CURLE_OK will be the result.
handle Resource of type curl indicates the handle which it concerns.

PHP: curl_multi_info_read - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 A curl_multi_info_read() example

<?php

$urls 
= array(
   
"http://www.cnn.com/",
   
"http://www.bbc.co.uk/",
   
"http://www.yahoo.com/"
);

$mh curl_multi_init();

foreach (
$urls as $i => $url) {
    
$conn[$i] = curl_init($url);
    
curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER1);
    
curl_multi_add_handle($mh$conn[$i]);
}

do {
    
$status curl_multi_exec($mh$active);
    if (
$active) {
        
curl_multi_select($mh);
    }
    
$info curl_multi_info_read($mh);
    if (
false !== $info) {
        
var_dump($info);
    }
} while (
$active && $status == CURLM_OK);

foreach (
$urls as $i => $url) {
    
$res[$i] = curl_multi_getcontent($conn[$i]);
    
curl_close($conn[$i]);
}

var_dump(curl_multi_info_read($mh));

?>

The above example will output something similar to:

array(3) {
  ["msg"]=>
  int(1)
  ["result"]=>
  int(0)
  ["handle"]=>
  resource(5) of type (curl)
}
array(3) {
  ["msg"]=>
  int(1)
  ["result"]=>
  int(0)
  ["handle"]=>
  resource(7) of type (curl)
}
array(3) {
  ["msg"]=>
  int(1)
  ["result"]=>
  int(0)
  ["handle"]=>
  resource(6) of type (curl)
}
bool(false)

PHP: curl_multi_info_read - Manual Home of Manuel PHP  Contents Haut

Changelog

Version Description
5.2.0 msgs_in_queue was added.

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-function.curl-multi-info-read.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut