I'm having trouble using the open(url) method.
This used to work fine, but I've recently updated gems, and it seems to have broken. Also, I've switched to running on ree-1.8.7 to try and mimic my heroku stack. Not sure if that might have something to do with it as well
at the top of my class I require:
require 'date' require 'nokogiri' require 'open-uri'
The code that is breaking it is:
puts(encoded_url) puts"trying to open doc" doc = open(encoded_url, "UserAgent" => "Ruby-OpenURI").read puts"just opened doc" return parsed_doc = Nokogiri::XML(doc)
the log out put is :
https://maps.googleapis.com/maps/api/place/search/xml?location=51.522416,-0.131836&radius=50000&types=bar|night_club|stadium|movie_theater&name=Hotel%20Suite%20Inn%20Pennsylvania&sensor=false&key=xxxxx(real key here) trying to open doc [Worker(host:Michael-Bs-MacBook-Pro.local pid:41513)] Admin::Events::ScraperManager failed with OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed - 1 failed attempts
/////
As you can see, it never gets to the line "just opened doc", so it is failing on
doc = open(encoded_url, "UserAgent" => "Ruby-OpenURI").read
Having googled around, I found a fix for OpenSSL, which involved creating certificates, and setting them like this
https.ca_file = '/opt/local/share/curl/curl-ca-bundle.crt'
but I don't have an https object, so how can I set these certificates!
Any help appreciated