phpQuestioner Posted March 2, 2007 Share Posted March 2, 2007 Is there any way to get a server time from another server, other then your own. I keep having trouble with my server's time bouncing up and down in AOL. Any way to do this? Link to comment https://forums.phpfreaks.com/topic/40933-server-time/ Share on other sites More sharing options...
dustinnoe Posted March 3, 2007 Share Posted March 3, 2007 The only thing I can think of is to write a php script that will echo the current time and out it on the desired server. Then fetch the url and read the output from the script. It would be a little web service. Link to comment https://forums.phpfreaks.com/topic/40933-server-time/#findComment-198288 Share on other sites More sharing options...
fert Posted March 3, 2007 Share Posted March 3, 2007 You could use php's socket functions to connect to port 13 of the server. Link to comment https://forums.phpfreaks.com/topic/40933-server-time/#findComment-198320 Share on other sites More sharing options...
skali Posted March 3, 2007 Share Posted March 3, 2007 This might be linux rdate probem. Anyway, There are NTP servers available. Use this code to query an NTP (Network Time Protocol) Server. <?php function query_time_server ($timeserver, $socket) { $fp = fsockopen($timeserver,$socket,$err,$errstr,5); # parameters: server, socket, error code, error text, timeout if ($fp) { fputs($fp,"\n"); $timevalue = fread($fp,49); fclose($fp); # close the connection } else { $timevalue = " "; } $ret = array(); $ret[] = $timevalue; $ret[] = $err; # error code $ret[] = $errstr; # error text return($ret); } ?> http://www.kloth.net/software/timesrv1.php Link to comment https://forums.phpfreaks.com/topic/40933-server-time/#findComment-198455 Share on other sites More sharing options...
AndyB Posted March 3, 2007 Share Posted March 3, 2007 I keep having trouble with my server's time bouncing up and down in AOL. I don't know what that means, but any time I see the name AOL I think of cache issues and proxy servers as the most likely causes of problems. Does your 'bouncing up and down' problem appear when other people (using non-AOL services) view the pages? Link to comment https://forums.phpfreaks.com/topic/40933-server-time/#findComment-198491 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.