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 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
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.


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

telnet 80
GET / HTTP/1.0

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

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

GET / HTTP/1.1

And,... bingo!

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

Gediminas said...

You can look to 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

Marion Palmer said...
This comment has been removed by the author.
Maria Owens said...

Internet service is too much involved in our best essay writing service that is quite different and against of our expectations. Now we can enjoy 4G internet service that help us in internet surfing in very nice speed.

Robert F. Crocker said...

What should you look for in a good W3 partner? What should you expect from the web hosting company you choose? A lot and plenty of it.
Weebly Email Hosting

Edward Ramirez said...

I haven't tried Telnet yet. And I will have time to try this soon because I find this very interesting. Please also visit superior essay for writing services as this will be of great help for your paper works.

Kale Co Jakim said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.

siva said...

This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.
Thank you for this blog. This for very interesting and useful.
Java training in Chennai
Java training in Bangalore
Java online training
Java training in Pune
Java training in Bangalore|best Java training in Bangalore

Related Posts with Thumbnails