简体   繁体   中英

How to send a URL request in rails?

I need to call a URL with parameters from a method in rails. How do I call the URL in rails? And example is that in the method, I want to call this URL request: www.example.com?name=parameter01&password=parameter02

How do I call this type of url method in rails?

Did you try this : 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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