Существует веб-сайт, когда вы посещаете определенные ссылки, он перенаправляет вас на другой сайт.
Есть ли способ узнать, какой HTTP-код возвращается, прежде чем они перенаправят вас?
Конечно, попробуйте curl:
$ curl -k https://www.gmail.com/
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
curl
, wget
, ... и другие веб-браузеры командной строки могут быть доступны не во всех ОС, просто используйте telnet
вместо:
$ telnet localhost 81
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /one/two?path=x&y=z HTTP/1.0
<enter>
<enter>
HTTP/1.1 301 Moved Permanently
Server: nginx/1.0.5
Date: Sat, 15 Oct 2011 02:38:59 GMT
Content-Type: text/html
Content-Length: 184
Location: http://127.0.0.1:81/one/two/x?y=z
Connection: close
Вы также можете пройти Host
заголовок:
telnet www.ganglia.gentoo 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0
Host: www.ganglia.gentoo
<enter>
<enter>
HTTP/1.1 301 Moved Permanently
Date: Sat, 15 Oct 2011 02:45:41 GMT
Server: Apache
Location: http://nagios.gentoo/
Content-Length: 297
Connection: close
Content-Type: text/html; charset=iso-8859-1