在一个形式点击一个按钮将发送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请求到不同的网站?