It’s running ~/public_html/runwebrick.rb=>
#!/home/user1/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
require ‘webrick’
root = File.expand_path ‘~/public_html’
server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => root
trap ‘INT’ do server.shutdown end
server.start
~/public_html/form.html=>
Username:~/public_html/process.rb=>
#!/home/user1/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
require “uri”
require “net/http”
#params = {‘name_input_username’ => ‘hello-world’,‘name_submit’ =>
‘Submit’}
x = Net::HTTP.post_form(URI.parse(‘http://localhost:8000/form.html’))
puts x.body
I got error for that=>
Method Not Allowed
unsupported method `POST’.
WEBrick/1.3.1 (Ruby/1.9.3/2012-04-20) at localhost:8000
Can anyone post complete code to get the value from html form post?
Any answer is highly appreciated.
Thanks in advance.