如何在铁轨上使用红宝石卷曲?像这个
curl -d 'params1[name]=name¶ms2[email]' 'http://mydomain.com/file.json'
解决方法
万一你不知道,它需要’net / http’
require 'net/http' uri = URI.parse("http://example.org") # Shortcut #response = Net::HTTP.post_form(uri,{"user[name]" => "testusername","user[email]" => "testemail@yahoo.com"}) # Full control http = Net::HTTP.new(uri.host,uri.port) request = Net::HTTP::Post.new(uri.request_uri) request.set_form_data({"user[name]" => "testusername","user[email]" => "testemail@yahoo.com"}) response = http.request(request) render :json => response.body
希望它能帮助别人.. 原文链接:https://www.f2er.com/ruby/274386.html