curl_multi_setopt

(PHP 5 >= 5.5.0)

curl_multi_setoptSet an option for the cURL multi handle

說明

bool curl_multi_setopt ( resource $mh , int $option , mixed $value )

Warning

此函式目前沒有參考文件;只有引數列表。

參數

mh

option

One of the CURLMOPT_* constants.

value

The value to be set on option.

value should be an int for the following values of the option parameter:

Option Set value to
CURLMOPT_PIPELINING Pass 1 to enable or 0 to disable. Enabling pipelining on a multi handle will make it attempt to perform HTTP Pipelining as far as possible for transfers using this handle. This means that if you add a second request that can use an already existing connection, the second request will be "piped" on the same connection rather than being executed in parallel.
CURLMOPT_MAXCONNECTS Pass a number that will be used as the maximum amount of simultaneously open connections that libcurl may cache. Default is 10. When the cache is full, curl closes the oldest one in the cache to prevent the number of open connections from increasing.

回傳值

如果成功則回傳 TRUE,失敗則回傳 FALSE

add a note add a note

User Contributed Notes 1 note

up
0
ryosuke_i_628 at yahoo dot co dot jp
8 years ago
If you want to enable both HTTP/1.1 pipelining and HTTP/2 multiplexing...

<?php
curl_multi_setopt
($mh, CURLMOPT_PIPELINING, 3);
?>

or

<?php
curl_multi_setopt
($mh, CURLMOPT_PIPELINING, CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX);
?>
To Top