我有一个问题,是否可以使用 telnet 获取网站的标题?网站看起来像这样domain.name.server.com/~USER(只是示例)。我想通过 telnet 获取它的标题。
telnet domain.name.server.com/~USER 80 <-- 不起作用
telnet domain.name.server.com 80工作,但我需要得到〜用户。有没有可能做到这一点?
Tho*_*ner 19
telnet domain.name.server.com 80然后使用
HEAD /~USER HTTP/1.1
Host: domain.name.server.com
Run Code Online (Sandbox Code Playgroud)
(然后你必须再打Enter一次。)
现在它应该向您显示此页面的标题。
以现实生活为例:
$ telnet unix.stackexchange.com 80
Trying 198.252.206.16...
Connected to unix.stackexchange.com.
Escape character is '^]'.
HEAD /questions/237635/using-telnet-to-get-website-header HTTP/1.1
Host: unix.stackexchange.com
HTTP/1.1 200 OK
Cache-Control: public, no-cache="Set-Cookie", max-age=60
Content-Length: 70679
Content-Type: text/html; charset=utf-8
Expires: Wed, 21 Oct 2015 19:27:43 GMT
Last-Modified: Wed, 21 Oct 2015 19:26:43 GMT
Vary: *
X-Frame-Options: SAMEORIGIN
X-Request-Guid: dbf9d0f6-0ca4-423f-98f0-4cdf2bf51bf1
Set-Cookie: prov=08886524-c640-40ad-a0ee-246db3219228; domain=.stackexchange.com; expires=Fri, 01-Jan-2055 00:00:00 GMT; path=/; HttpOnly
Date: Wed, 21 Oct 2015 19:26:43 GMT
Connection closed by foreign host.
Run Code Online (Sandbox Code Playgroud)