About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Monday, 1 June 2009

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

Interesting, today I came to know there is a way through telnet to get the requests from the server.

Normally we don't see what sent between the web server and the client. Here is the way we can see what's actually received through the telnet.

To connect to the web server - open a command line and type the command
telnet host port

telnet localhost
8080

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
HEAD pageName HTTP/1.0

Hit enter twice. Then you will get a response.


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.

1 comment:

Madhusuthanan Seetharam said...

Good one. Keep up the good work, Prakash.