ruby-on-railsurl

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?


Solution

  • 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