I'm using Windows 7 (x64). I want to send an http request from a command line and to get a response. I use Telnet. I type in the command line: telnet www.google.com 80
.
After I press "enter" the screen becomes black (everything disappears from the cmd screen).
After a couple of minutes it shows a standard command prompt without outputting anything.
When I launch telnet in my command line (typing telnet
without parameters) and type o www.google.com 80
, it outputs Connecting to www.google.com
. After a few minutes it says press any key
. After pressing any key it outputs The connection was lost
My question is: how can I actually get an http response? What am doing wrong?
The connection is established and waiting for you to enter a command. Type GET / HTTP/1.0
and press Enter twice. The command is case-sensitive. It's not displayed as you type, because localecho is off by default. You can enable localecho like this:
C:\>telnet
Welcome to Microsoft Telnet Client
Escape Character is 'CTRL++'
Microsoft Telnet> set localecho
Local echo on
Microsoft Telnet> open www.example.com 80
Connecting To www.example.com...
GET / HTTP/1.0
Or you could use PuTTY
, which displays the typed text by default (you need to configure the session to not close the Window on exit, though).
For more information about HTTP see Wikipedia. For the protocol specification see RFC 2616.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With