单击表单中的按钮将发送POST请求以由以下代码处理.
post '/register' do #send post request to http://www.randomsite.com #parse response #do something with it @user = User.first(:name => params['regUsername']) if @user == nil @user = User.create( :name => params['regUsername'],:pass => Password.create(params['regPassword']),:email => params['regEmail'],:created_date => Time.now ) redirect '/' else "User already exists." end end
如何从Ruby代码中向另一个网站发送另一个POST请求?