Jaanus
Jaanus

Reputation: 16541

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 $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);
curl_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?

Upvotes: 1

Views: 772

Answers (1)

Danzan
Danzan

Reputation: 968

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);

Upvotes: 1

Related Questions