Thursday, October 30, 2008

How to Telnet to a Web Server - HTTP Requests through Telnet

A web server, responding to a HTTP GET request sends the required content to the client. Normally we don't see what is sent between the web client and the server. However we can easily see what is sent by the server by telneting to that web server.

To connect to the web server - open a command line and type the command
telnet host port
eg. telnet www.wso2.com 80

Then you'll get connected to the particular web server and then you can enter any HTTP command you want such as GET, HEAD.

If you need to request for a web page from the web server you can type the HTTP request as follows.

GET pageName HTTP/1.0
eg. GET /products HTTP/1.0

Hit enter twice. Then you will get a response (if page exists)as follows.

HTTP/1.0 200 OK
Date: Thu, 30 Oct 2008 18:17:16 GMT
Server: Apache/2.2.9
X-Powered-By: PHP/5.2.6
Set-Cookie: PHPSESSID=5322082bf473207961031e3df1f45a22; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Pingback: http://wso2.com/xmlrpc.php
Connection: close
Content-Type: text/html; charset=UTF-8

content goes here

.
.
.


You'll get a 404 status if page not found, 301 if the page is moved permanently and 401 if you are not authorized to access the page. More HTTP status codes can be found here.

You can follow a similar way to issue other HTTP commands with the relevant content.

6 comments:

ශාකුන්තල said...

telnet kalanir.blogspot.com 80
GET / HTTP/1.0

doesn't work.... what to do?

Coz that's HTTP 1.1... virtual hosting.. ;-)

just,
GET / HTTP/1.1
Host: kalanir.blogspot.com

And,... bingo!


Anyway,... this telnet thing is a great thing that can sometimes find 'secrets'. :-)

Gediminas said...

You can look to http://sourceforge.net/projects/wwwposter/ for working example

kalani Ruwanpathirana said...

Oh..thanks Shakunthala..

Er Prince Bhalani said...

can you tell me if website use post command then how can get server detail using telnet???

Zahid Rahman said...



Great Post about Server support. I can see that you will be a professional Man By this site.
We have also arranged a service.
Our Emergency Exchange SupportTeam provides emergency support and assistance.
Our Exchange Server experts can log on remotely to diagnose and fix just about any problem you may be experiencing,
24×7. Today’s advanced remote desktop tools, which are included with Microsoft Windows Server OS,
allow us to rapidly support Microsoft Exchange just as if we were at your place of business.



Emran Tonmoy said...

Thanks for post your valuable opinion. I think it will be valuable for all kinds of Users.
Please contiune .
Emergency Exchange Support

I can see that its a Emergency support Relevant Blog. But I wil suggested you If you have any problem any kinds of Server Releted. You can Contact with us.
Emergency Exchange Support

Related Posts with Thumbnails