我需要从 Rails 中的方法调用带有参数的 URL。如何在 rails 中调用 URL?示例是在该方法中,我想调用此 URL 请求:www.example.com?name=parameter01&password=parameter02
如何在rails中调用这种url方法?
最佳答案
你试过这个吗:http://ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net/HTTP.html ?
一个例子:
require 'net/http'
uri = URI('http://example.com/index.html?key=value')
req = Net::HTTP.get(uri)
puts req #show result
关于ruby-on-rails - 如何在 Rails 中发送 URL 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11615052/