I’ve been experimenting using open-uri to retrieve HTML from various
sites and have spent the past couple of days searching for an answer to
my problem. One page I’ve been trying to access contains a GUID in the
querystring and it has curly brackets around it. This is my code (I’m
just using Google for this example):
html = open(uri).read()
But I get the following error:
URI::InvalidURIError in DemoController#index
bad URI(is not URI?):
From what I’ve found, curly brackets aren’t allowed in a Ruby URI
(despite my browser being capable of handling them). I’ve tried encoding
them with %7B and %7D but then the page is called with the encoded
version, which in my case, the site isn’t expecting and it doesn’t work.
Is there a way to allow curly brackets in my URI? or another method to
download HTML which does?