开发者

PHP cURL multi handling

开发者 https://www.devze.com 2023-03-06 13:55 出处:网络
$ch = curl_init(); $ch1 = curl_init(); $mh = curl_multi_init(); curl_multi_add_handle($mh,$ch); curl_multi_add_handle($mh,$ch2);
$ch = curl_init();
$ch1 = curl_init();

$mh = curl_multi_init();    
curl_multi_add_handle($mh,$ch);
curl_multi_add_handle($mh,$ch2);

Can i change options of $chor $ch1for example like this :

curl_setopt($ch1, CURLOPT_REFERER, $ref);
curl_setopt($ch1, CURLOPT_USERAGENT, $useragent);

$data = array('cmd' => 'login', 'username' => 'test', 'password' => 'test');
curl_setopt($ch, CURLOPT_POST, true);
c开发者_如何学Pythonurl_setopt($ch, CURLOPT_POSTFIELDS, $data);

Does it change the values of $ch1 and $ch inside the curl multi handler also? So basically I am asking if I can change the options of curl handles even after I added them to a multi handler?


Yes you may change any options of each curl child.

curl_setopt($ch1, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, "http://www.example2.net/");
curl_setopt($ch, CURLOPT_HEADER, 0);
0

精彩评论

暂无评论...
验证码 换一张
取 消