1

On Windows I want to make simple HTTP requests to find bugs in my scripts. Of course I usually use more convenient tools (like the "REST client"-plugin in Firefox) but now I want to go one level deeper.

How can I make HTTP requests in Windows from command line?

I tried to use Plink (from PuTTY):

plink -telnet -P 80 servername GET /index.php

But the server keeps telling me, that

The request verb is invalid.

Probably it ignores the GET /index.php part.

  • I don't have telnet (I'm using my company's PC and I can't install that Windows feature here)
  • I want to keep it low-level (not following any redirects, etc.)
4
  • "I don't have telnet (since it is not included in current windows versions)" It is included, it's just not installed by default. You can install/enable the Windows telnet client by using Add/Remove Programs -> Turn Windows Features On/Off. – Ƭᴇcʜιᴇ007 Nov 9 '15 at 17:56
  • @Ƭᴇcʜιᴇ007 Thanks for the hint - but right now I cannot install that windows feature (I updated my question). Any ideas, why plink doesn't work? – slartidan Nov 9 '15 at 18:04
  • 1
    You are using PLink right, but I think that since you mention this is a REST web service, then you are simply issuing an incorrect GET request. As it says: index.php is not a valid Request Verb for that service (basically, you need to specify the function to run in the web service). – Ƭᴇcʜιᴇ007 Nov 9 '15 at 18:08
  • You have a coulple of alternatives.**Linux/Unix** first you could check if port is open:nc -z [ipaddress] 80 and to do some http requests you can use:curl http://example.com/ it will perform Reading a URL via GET: – Francisco Tapia Nov 9 '15 at 19:14
2
  1. You cannot use the Telnet protocol to implement the HTTP. PuTTY will send some Telnet control sequences that break the HTTP protocol. You need to use a "raw" connection using the -raw switch (instead of the -telnet).

  2. You can specify the command on Plink command-line with the SSH protocol only. It does not work with the raw connection or the Telnet. But you can use an input redirection.

This should work:

echo GET /index.php | plink.exe -raw -P 80 servername

Though you better use some more powerful tool. Examples:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.