<?php
function get_time($server){
$data = "HEAD / HTTP/1.1\r\n";
$data .= "Host: $server\r\n";
$data .= "Connection: Close\r\n\r\n";
$fp = fsockopen($server, 80);
fputs($fp, $data);
$resp = '';
while ($fp && !feof($fp))
$resp .= fread($fp, 1024);
preg_match('/^Date: (.*)$/mi',$resp,$matches);
return strtotime($matches[1]);
}
?>
<?php
echo date('Y-m-d H:i:s',get_time("www.codefans.net"));
?>