From: Brian Candler Date: 2009-12-24T05:31:05+09:00 Subject: Re: Displaying the html from a ruby .cgi script Marc Heiler wrote: > I have a script, foobar.cgi > > I can load it into my browser, as in > http://localhost/foobar.cgi > > It generates html code. I am using Apache on Linux here, > everything is local only. > > My question is: > > Is there an easy way to grab that generated html code and > display it (as a long string) on a console? (1) curl http://localhost/foobar.cgi With appropriate command-line options you can also POST to the CGI easily enough. (Maintaining a session with cookies would be more awkward though) (2) I believe you should just be able to run the CGI from the command line: /path/to/foobar.cgi or ruby /path/to/foobar.cgi in which case it'll prompt you for any parameters, then press ^D to get the response. (3) The very manual way: telnet localhost 80 GET /foobar.cgi HTTP/1.0 Host: localhost -- Posted via http://www.ruby-forum.com/.