Mega Code Archive

 
Categories / Ruby / CGI
 

Accepting CGI Variables

#!/usr/bin/ruby require 'cgi' cgi = CGI.new text = cgi['text'] puts cgi.header puts "<html><body>#{text.reverse}</body></html>" You could test this CGI script by passing the text directly within the URL,  such as with http://www.example.com/test.cgi?text=this+is+a+test.