note 64050 deleted from function.date by bjori

From: Date: Thu, 06 Apr 2006 16:39:18 +0000
Subject: note 64050 deleted from function.date by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-107451@lists.php.net to get a copy of this message
Note Submitter: Timothy Allen (FlipperPA) Reason: useless ---- Here's a bit of a hack that is handy to run as a cron job to keep your system clock in sync (for *nix systems). While this is subject to change, the www.time.gov web site hasn't changed in about a decade. Its currently set for the United States east coast time; change the URL's "-5" to set appropriately for your time zone. <?php $fp=fopen("http://www.time.gov/timezone.cgi?Eastern/d/-5","r"); while(!feof($fp)) { $data=fgets($fp,4096); if(strstr($data,"<td align=\"center\"><font size=\"7\" color=\"white\"><b>")) { $data=trim(str_replace("<td align=\"center\"><font size=\"7\" color=\"white\"><b>","",str_replace("<br>","",$data))\ ); $data=explode(":",$data); if(strlen($data[2]==1)) $data[2]="0".$data[2]; exec("date ".date("md").$data[0].$data[1].date("y").".".($data[2]+3)); echo("date ".date("md").$data[0].$data[1].date("y").".".($data[2]+3)); die(); } } ?>

« previous php.notes (#107451) next »