Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Requesting the http header 1

Status
Not open for further replies.

ddrillich

Technical User
Jun 11, 2003
546
US
Good Day,

An SA showed me once how to ping a webserver and get the http header. Does anybody know how to do it? I need to see how the encoding (utf8) is set up.

Thanks,
Dan
 
There's a browser plug in called "Live HTTP Headers" that lets you see all the headers going to and from your browser. It's at...


You can also get the header using [tt]telnet[/tt]. Just [tt]telnet[/tt] to the port the webserver is using (usually 80), and type in the minimum request. The request looks like the following...
Code:
HEAD <page-URI> HTTP/1.1
Host: <host>
Connection: close
So, for example, if you are looking for the header returned for the root page at "livehttpheaders", do the following (the part you type is in bold)...
Code:
$ [b]telnet livehttpheaders.mozdev.org 80[/b]
Trying 167.206.76.23...
Connected to livehttpheaders.mozdev.org.
Escape character is '^]'.
[b]HEAD / HTTP/1.1
Host: livehttpheaders.mozdev.org
Connection: close[/b]
It needs to be ended with two returns. Also you might need to type fast as some web servers will time out the connection if it's not done quickly. It will then dump the header back to you. You can also change the HTTP version from 1.1 to 1.0 to get a simpler response.

Hope this helps.
 
Hi Sam,

I did the following:

telnet 172.24.130.21 80
HEAD / HTTP/1.0

And got:

HTTP/1.1 200 OK
Server: Netscape-Enterprise/6.0
Date: Fri, 24 Feb 2006 21:21:12 GMT
Content-length: 0
Content-type: text/html
Connection: close

Connection to host lost.

Is there a way to see the full header?

Thanks,
Dan
 
I'm interested in the Content-Encoding and Content-Language header fields – I have an encoding problem.

Any ideas?

Thanks,
Dan
 
That is the full header. The "200" is the return code of SUCCESS from the web server.

The Contenet-type is "text/html", so it's just plain text. There should be no encoding.

But this is JUST the header. If you want to get the whole page back, change the [tt]HEAD[/tt] to a [tt]GET[/tt].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top