简体   繁体   English

如何在Rails中发送URL请求?

[英]How to send a URL request in rails?

I need to call a URL with parameters from a method in rails. 我需要使用Rails中的方法调用带有参数的URL。 How do I call the URL in rails? 如何在Rails中调用URL? And example is that in the method, I want to call this URL request: www.example.com?name=parameter01&password=parameter02 例子是在该方法中,我想调用此URL请求:www.example.com?name=parameter01&password=parameter02

How do I call this type of url method in rails? 如何在Rails中调用这种类型的url方法?

Did you try this : http://ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net/HTTP.html ? 您是否尝试过: http : //ruby-doc.org/stdlib-1.9.3/libdoc/net/http/rdoc/Net/HTTP.html

An example : 一个例子 :

require 'net/http'
uri = URI('http://example.com/index.html?key=value')
req = Net::HTTP.get(uri)
puts req #show result

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM