Accepting CGI Variables : CGI Variables « CGI « Ruby






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.

 








Related examples in the same category