From: Jeff Peng Date: 2010-01-21T21:58:45+09:00 Subject: Re: Sending form data to a text file 在 2010-01-21四的 21:17 +0900,Will H.写道: > #!/usr/local/bin/ruby > > require 'cgi' > cgi = CGI.new > Hi, Though I never wrote a ruby CGI, but it's not that hard to write one with class CGI. I wrote and put this script into cgi-bin directory: #!/usr/bin/ruby require 'cgi' cgi = CGI.new user = cgi['username'] pass = cgi['password'] time = Time.now.strftime("%D %T") cgi.out("text/plain") do "Time: #{time}\n" + "User: #{user}\n" + "Pass: #{pass}" end And access it with such url like: http://127.0.0.1/cgi-bin/test.cgi?username=test&password=testpass It just works fine. You also want to check if webserver has the priviledge to write to the file you like to create. Check webserver's error_log for any error. Ruby's CGI document: http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/ HTH.