获取网络服务器的当前时间 [英] Get current time of webserver

查看:46
本文介绍了获取网络服务器的当前时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以获取网络服务器的当前时间.例如,我想访问某个任意网站,并获取托管该网站的网络服务器的当前时间.

I was wondering if it were possible to get the current time of a webserver. So for example, I'd like to go on some arbitrary website, and get the current time of the webserver hosting the website.

如果它有所作为,我知道一些 php、html 和 css.我知道 C++,但我怀疑这会有所帮助.

If it makes a difference, I know some php, html and css. And I know C++, though I doubt that'd help.

谢谢.

推荐答案

<?php
print_r(get_headers("http://www.google.com"));
?>

输出:

Array
(
    [0] => HTTP/1.0 302 Found
    [1] => Location: http://www.google.co.nz/
    [2] => Cache-Control: private
    [3] => Content-Type: text/html; charset=UTF-8
    [4] => Set-Cookie: PREF=ID=099aa9ac8980212e:FF=0:TM=1329099372:LM=1329099372:S=E_PStXZJPIz2ZMm7; expires=Wed, 12-Feb-2014 02:16:12 GMT; path=/; domain=.google.com
    [5] => Date: Mon, 13 Feb 2012 02:16:12 GMT
    [6] => Server: gws
    [7] => Content-Length: 221
    [8] => X-XSS-Protection: 1; mode=block
    [9] => X-Frame-Options: SAMEORIGIN
    [10] => HTTP/1.0 200 OK
    [11] => Date: Mon, 13 Feb 2012 02:16:13 GMT
    [12] => Expires: -1
    [13] => Cache-Control: private, max-age=0
    [14] => Content-Type: text/html; charset=ISO-8859-1
    [15] => Set-Cookie: PREF=ID=a4441cbc36cea461:FF=0:TM=1329099373:LM=1329099373:S=I6zlXb015nXUM0ht; expires=Wed, 12-Feb-2014 02:16:13 GMT; path=/; domain=.google.co.nz
    [16] => Set-Cookie: NID=56=22IthPMv3iR1hlwH0VkhSNq4imnzW4AhPoKM_3boXysAA-Zf4iM0u8Uv6EeV7coLnW91WQqGXyC9AtR4Snh9IG9kSfZRz8pk_X48VwV6UR0eY4c_UrtT8Wdk2zRyNcgR; expires=Tue, 14-Aug-2012 02:16:13 GMT; path=/; domain=.google.co.nz; HttpOnly
    [17] => P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
    [18] => Server: gws
    [19] => X-XSS-Protection: 1; mode=block
    [20] => X-Frame-Options: SAMEORIGIN

)

我不会依赖它,你想达到什么目的?

i would not rely on it, what are you trying to achieve?

这篇关于获取网络服务器的当前时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆