PHP cURL multi handling
$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 $ch
or $ch1
for 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);
精彩评论