0

Dumb question: is there a batch-mode utility (e.g. particular options for curl or wget) that can let me issue raw HTTP commands, and either output the raw results or pipe/redirect it as I see fit?

I know telnet theoretically works but I'm running Windows XP and both Microsoft telnet and PuTTY seem to be interactive and seem to screw things up.


edit: (clarification) I've used curl before, so am familiar w/ the idea, as well as how to send parameters via GET/POST, just not how to control the headers explicitly, and how to keep headers in the output... I can see two possible methods that would be useful to me:

  1. Raw HTTP I/O -- I had meant literally like telnet but in batch mode (not opening up a new window or mucking with the terminal settings):

    GET http://someserver/someresource/blah.html
    HTTP/1.1 301 Moved Permanently
    Date: Wed, 14 Oct 2009 21:23:40 GMT
      ...
    
  2. "easy" input, raw HTTP output -- using curl in the normal methods, but being able to see the raw output verbatim:

    > curl --some-option --another-option http://someserver/someresource/blah.html
    HTTP/1.1 301 Moved Permanently
    Date: Wed, 14 Oct 2009 21:23:40 GMT
      ...
    

5 Answers 5

2

Yes, both curl and wget can do this. Please give us more details on what kind of commands you want to execute.

Random example:

wget --post-data="Some random data sent via POST" "http://example.com/cgi/something.php?arg=1&foo=bar" -q -O results.txt

Sends some data via POST, as well as some arguments via GET to a specific URL. -q means don't give me progress updates, -O specifies what file to output to. Use -O - if you would like to pipe the results instead of saving to a file.

1
  • Curl or wget cannot send a bunch of http headers specified in a file with the request, which is what I understood OP was after.
    – eis
    Nov 11, 2016 at 10:38
2

Curl or wget are good options. But if you really want to have something equivalent to telnet you should probably use netcat (win32) instead of using telnet. Netcat is designed for raw i/o telnet isn't.

1

HTTP Client for Mac OS X is handy, http://ditchnet.org/httpclient/

1
1

For "easy" input, raw HTTP output : curl -i --raw http://google.fr

For the other i guess that telnet is your best chance.

0

telnet

http://www.gnu.org/software/inetutils/

http://windows.microsoft.com/en-US/windows-vista/Telnet-frequently-asked-questions

1
  • 1
    or 'netcat' if you prefer.
    – neoice
    Oct 15, 2009 at 1:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .