0

Sorry for stupid question... can i use same curl_init() for different resource ? If not why?

$name= array("mysite1","mysite2","mysite3");
$figli= 3;

$ch = curl_init();

for($i=0; $i < $figli; $i++){
$url=  'http://www.'.$name[$i].'.com'; 

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources


};
curl_close($ch);  

Thanks a lot and sorry for my english :)

Borja
  • 3,359
  • 7
  • 33
  • 66
  • Are you trying to make concurrent curl requests ? – Indian Dollar Mar 29 '17 at 12:51
  • Please check this link it will clear your concept. http://stackoverflow.com/questions/3787002/reusing-the-same-curl-handle-big-performance-increase – Maya Shah Mar 29 '17 at 12:51
  • yes @MayaShah i read that question and i understand that using same curl for many request will increase my performance. But i don't know if is correct to use it for many, different, url. Different... – Borja Mar 29 '17 at 12:53

0 Answers0