J
JesseQA
Hi everyone. A newbie with ruby/xml so I am not sure where my trouble
is with my code. It does not seem to do anything when I run it. Your
help is much appreciated!
Here is my code:
I am trying to post an XML file but it does not seem to do anything.
Can someone take a look at this code and tell me if it looks correct?
Thank you!
require 'rubygems'
require 'net/https'
require 'net/http'
require 'uri'
require 'nokogiri'
url = "http://mydomain.com/Will.do?method=ntf"
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if (uri.scheme == 'https')
f = File.open('my.xml','r')
data = Nokogiri::XML(f)
f.close
headers = {'Content-Type' => 'text/xml'}
resp, body = http.post(uri.path, data.to_xml, headers)
is with my code. It does not seem to do anything when I run it. Your
help is much appreciated!
Here is my code:
I am trying to post an XML file but it does not seem to do anything.
Can someone take a look at this code and tell me if it looks correct?
Thank you!
require 'rubygems'
require 'net/https'
require 'net/http'
require 'uri'
require 'nokogiri'
url = "http://mydomain.com/Will.do?method=ntf"
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if (uri.scheme == 'https')
f = File.open('my.xml','r')
data = Nokogiri::XML(f)
f.close
headers = {'Content-Type' => 'text/xml'}
resp, body = http.post(uri.path, data.to_xml, headers)