I'm not following you.
If the above link is a URI representing the file (with the appropriate
content-type) then open-uri should get the file. Of course, if that URI
represents an HTML page then yes, you would get an HTML page.
HTTP is content agnostic. It will simple GET (or POST, PUT, DELETE,
etc.) whatever the URI represents.
OpenURI is just a wrapper around net/http, net/https & net/ftp:
http://www.ruby-doc.org/core/classes/OpenURI.html
--
Posted via http://www.ruby-forum.com/.
You are on the right track, but if OpenURI is pulling down an HTML page
then you may be pointing at the wrong place. With that sorted all you
need to do is something like the following:
require 'open-uri'
file = Tempfile.new
file.binmode
open(url, headers) { |data| file.write data.read }
That will give you your content in the file variable, and then you can
encode away.
Unless it is possible to get the exact url that represents the other
resource you're trying to download I can't see how you'll save the
resource locally. Is this a service you have a correspondance with? Look
into how to link directly, maybe contact the site maintainer.
Perhaps somebody else will have a good method for capturing though.