1

i want to write a script using curl_multi_init() but i must have to specify the curl_setopt() with my proxy only once and not for each handle, there is a way to solve this with different proxy for each handle?


i got the solution, specify the proxy that you want with a new curl_init() then add a new handle.

$master = curl_multi_init();
$curl_arr[1] = curl_init();
curl_setopt($curl_arr[1], CURLOPT_PROXY, $proxy);
curl_multi_add_handle($master, $curl_arr[1]);
do {
 curl_multi_exec($master,$running); //while there are running connections just keep looping
 } while($running > 0);
$data = curl_multi_getcontent($curl_arr[1]);

and ect.

velcrow
  • 6,336
  • 4
  • 29
  • 21
Ben
  • 249
  • 5
  • 19

0 Answers0