I have a code that sends a request to a PHP page to get it's headers. The thing is, on that page, copy() function is executed and cURL either waits for the whole page to load (finish copying) or returns false if I set timeout to 2-3 seconds. How do I get page headers without waiting for copy() function to finish doing it's job?
My code so far is:
$req='page_with_copy_function_in_it.php';
$ch=curl_init($req);
curl_setopt($ch,CURLOPT_NOBODY,true);
curl_setopt($ch,CURLOPT_HEADER,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_TIMEOUT,2);
$data=curl_exec($ch);
curl_close($ch);