i use this php code to grab a web page. i use time_sleep_until but it does not seem to even exist?
filesize comparison seems to be ignored too? (i have tested and it did give correct file size.)
filesize comparison seems to be ignored too? (i have tested and it did give correct file size.)
while(1) { $simpledate=date('Y-m-d H:i:s'); $date=strtotime($simpledate); $year=date('Y',$date); $month=date('m',$date); $day=date('d',$date); $hour=date('H',$date); $minute=date('i',$date); $sec=date('s',$date); $tomorrow=mktime(0, 0, 0, date("m"), date("d")+1, date("y")); if ($hour>23) { $str=$tomorrow.' 9:10:30'; $timestamp=strtotime($str); time_sleep_until($timestamp); } $oldsize=filesize('todays11'); $myURL ="http://example.com/"; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_URL, $myURL); curl_setopt($ch, CURLOPT_HTTPGET, TRUE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); $content=curl_exec($ch); $myfile='todays11'; $f=fopen($myfile,'w') or die ('cant open file'); fwrite($f,$content); fclose($f); $newsize=filesize($myfile); if(floor($newsize/100)==floor($oldsize/100) || $newsize<10) { // try again sleep (60); } else { if($minute<50)$minute=floor($minute/10)*10+10; else {$hour=$hour+1; $minute=00;} $str=$year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.':30'; $timestamp=strtotime($str); time_sleep_until($timestamp); } }