continue on php curl 10 seconds timeout
code
<?php $directory = 'http://www.google1.com'; $returntransfer = true; $connecttimeout = 10; timeout = 10; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $directory); curl_setopt($ch, CURLOPT_RETURNTRANSFER, $returntransfer); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connecttimeout); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); sleep(10); //wait 10 sec on browser $execute = curl_exec($ch); $curl_errno = curl_errno($ch); $curl_error = curl_error($ch); curl_close($ch); if ($curl_errno > 0) { echo "cURL Error ($curl_errno): $curl_error\n"; } ?>From the above code, my questions is the following:
(1) When I use thesleep(), it will wait 10 seconds on the web page but theCURL_CONNECTTIMEOUTandCURLOPT_TIMEOUTseems nothing happened? Why?
(2) How do I know that theCURLOPT_CONNECTTIMEOUTandCURLOPT_TIMEOUTis set?
$directory = 'http://www.google1.com';to$directory = 'http://www.google.com';