Search code examples
ruby-on-railsformspostsubmitexternal-url

Can I POST a form to an external URL and also my own server?


In rails, can I get a form submit to send the info in the form both to an external URL, and also post to my own server, all with one click from the user?


Solution

  • In the create or update actions in the controller, after the save action:

    require 'net/http'
    Net::HTTP.get('www.example.com', '/index.html?'+params)