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
      ...
    
link|improve this question

72% accept rate
feedback

5 Answers

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

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

link|improve this answer
The OP said nothing about OS X. – Dennis Williamson Oct 14 '09 at 21:47
feedback

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

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

link|improve this answer
feedback

telnet

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

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

link|improve this answer
1  
or 'netcat' if you prefer. – neoice Oct 15 '09 at 1:29
feedback

Your Answer

 
or
required, but never shown

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