0

Winging curl code and I have a lot of preg_match_all(); and getting some data and url. Sometimes it processes it all, sometimes it misses some parts.

Is there any function to make it wait till all curl finish or speed up the process?

$ch = curl_init();

curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path);   // Cookie management.
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 

$result = curl_exec($ch);

curl_close($ch); 

// Step3. parsing username
preg_match_all("#<span id=\"class\" class=\"tall\">(.*?)</span>#si", $result, $match);

and got alot preg_match_all commands there

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141

0 Answers0