Reputation: 9
Requirement: User fills out form A. Data from form A is then passed to form B on another site.
Upvotes: 0
Views: 702
Reputation: 16844
I suggest you check out mechanize. https://github.com/tenderlove/mechanize
Say the site is http://mysite.com
, and there's one field "name" that you want to fill in.
require 'mechanize'
def fill_out_form(name)
# our agent
agent = Mechanize.new
# load mysite.com
page = agent.get('http://mysite.com')
# Fill out the form
form = page.form_with(:name => 'name-form')
form.name = name
page = agent.submit(form)
end
then just call this from your controller
FormFiller.fill_out_form(params[:name])
Upvotes: 3