Skip to content

Instantly share code, notes, and snippets.

@csexton
Forked from jasonlyles/gist:211928
Created October 16, 2009 18:07
Show Gist options
  • Save csexton/211935 to your computer and use it in GitHub Desktop.
Save csexton/211935 to your computer and use it in GitHub Desktop.
params = {'server[ip_address]' => localhost.ip_address, 'server[hostname]' => localhost.hostname,
'server[param_1]' => localhost.registry_user_base_dir, 'server[default_gateway]' => localhost.default_gateway,
'server[param_2]' => localhost.registry_sql_connect, 'server[netmask]' => localhost.netmask, 'server[route_table]' =>
route_table, 'server[os]' => localhost.os, 'server[build_date]' => localhost.build_date, 'server[service_pack]' =>
localhost.service_pack, 'server[subnet]' => localhost.subnet, 'server[persistent_route_table]' => persistent_route_table}
#old way
#x = Net::HTTP.post_form(URI.parse('http://report1.atbackup.local/servers/create'),params)
#new way
url = URI.parse('http://report1.atbackup.local/servers/create')
req = Net::HTTP::Post.new(url.path)
req.set_form_data(params)
req.set_content_type('text/xml')
res = Net::HTTP.new(url.host, url.port).start{|http| http.request(req)}
puts res.code
puts res.body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment