Brian Candler
2/7/2007 2:39:00 PM
On Wed, Feb 07, 2007 at 08:54:43PM +0900, Max Russell wrote:
> > I'd suggest you don't parse the document using REXML. Just read it in as
> > a
> > file, and then squirt it out over the HTTP connection. I'm not sure how
> > http.post will cope with being given an REXML::Document object.
> >
> > Try "ri Net::HTTP" for some samples of how to do a HTTP POST.
> > (or "ri1.8 Net::HTTP" under Ubuntu).
>
> I've had a look at this documentation, the sections pertaining to POST
> all refer to form data (e.g. looking at a search box and posting info,
> setting dates and posting etc.) , rather than an individual POST of a
> file.
It looks easy enough to me:
require 'net/http'
doc = <<EOS
<foo>
bar!
</foo>
EOS
res = nil
Net::HTTP.start("rubyforge.org", 80) do |http|
res = http.post('/wibble/wobble', doc)
end
puts res.inspect