Skip to content

Instantly share code, notes, and snippets.

@csexton
Forked from jasonlyles/gist:211928
Created October 16, 2009 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csexton/211951 to your computer and use it in GitHub Desktop.
Save csexton/211951 to your computer and use it in GitHub Desktop.
xml = <<-eos
<?xml version="1.0" encoding="UTF-8"?>
<server>
<build-date type="datetime" nil="true"></build-date>
<created-at type="datetime" nil="true"></created-at>
<default-gateway>10.60.1.4</default-gateway>
<hostname>XML Test</hostname>
<ip-address>0.0.0.0</ip-address>
<netmask>255.255.0.0</netmask>
<os>FuzzyOS</os>
<param-1 nil="true"></param-1>
<param-2 nil="true"></param-2>
<param-3 nil="true"></param-3>
<param-4 nil="true"></param-4>
<param-5 nil="true"></param-5>
<persistent-route-table>#&lt;RouteTable:0x440aac0&gt;</persistent-route-table>
<route-table>#&lt;RouteTable:0x440af5c&gt;</route-table>
<server-type nil="true"></server-type>
<service-pack nil="true"></service-pack>
<subnet>0.0.0.0</subnet>
</server>
eos
require 'net/http'
url = URI.parse('http://report1.atbackup.local/servers/create')
req = Net::HTTP::Post.new(url.path)
req.body = xml
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