Smart people, please tell me how to get the http header of the local server response? It is clear that you can use the Yandex Webmaster to get a response from a remote server, but such a thing is not suitable for a server raised on a working machine. Can there be any plugin for Firefox that shows headers, or is there any option for Lunx to view the response code ??

  • one
    wireshark? - Dex

2 answers 2

You can receive and for a separate page. Yuzay telnet

telnet www.you_site 80 (ну или другой порт)GET /first/second/file.php HTTP/1.0 <жмём ENTER>Host:www.you_site<жмём ENTER дважды> 

There must be an answer, and then the connection will be broken.

  • Yes, he also returns the answer, if you have time to enter the path after GET =) Although, for some reason, it returns 400 code for the page where there should be 200. In fact, it didn’t matter, it turned out to be more convenient with cURL. - TomaZ

There is neither a telnet (or analog) nor a local server at hand, so the answer is “speculative”.

Try to transmit via

 telnet localhost 80 

http get request or head

 GET / HTTP/1.1илиHEAD / HTTP/1.1 

as far as I remember, there should be at least one empty string '\ r \ n' after the command, so make sure that telnet is set to terminate the lines with a pair of '\ r \ n'

  • And can she somehow get an answer for the page of the site? Those. not just for a "server" like: "test.ru", but "test.ru/first/second/file.php"? As far as I understand, telnet is not designed for this? - TomaZ
  • In fact, I’ve already turned through the cURL library for PHP => <? Php if ($ curl = curl_init ()) {curl_setopt ($ curl, CURLOPT_URL, ' test.ru/first/file.php' ); curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ curl, CURLOPT_NOBODY, true); curl_setopt ($ curl, CURLOPT_HEADER, true); var_dump (curl_exec ($ curl)); curl_close ($ curl); }?> But is it really impossible to somehow somehow do it through a browser? ... - TomaZ
  • I do not quite understand what you mean. Telnet simply sends the characters you enter to host: port via tcp and displays the text sent by the server to the console (current window). If the window allows, you can Copy-Paste to save answers . - avp 1
  • it is also possible through the browser, in particular through FF, only with the LiveHeader add-on installed (as it is called) or the like - danila 1