okkezSS
#1
I am using native ruby api calls to IE without waitr to retrieve
information from google maps.
I am trying to capture the following output which is just a simple
string:
http://maps.google.com/maps/geo?q=123+main+street+ottawa+canada&output=csv
The output is this:
200,8,45.4106089,-75.6788888
How can I capture that information inside a variable since there are
no HTML tags?
This dosn’t seem to work:
geo_code = ie.Document.All.tags("")
Hi
I could get the code by
ie.document.getElementsByTagName(‘pre’).item(0).innerHTML
but at this case, I recomend you to use open-uri, it’s more simple and
fast and not depend on Windows.
ex)
require ‘open-uri’
csv = nil
open(‘http://maps.google.com/maps/geo?q=123+main+street+ottawa+canada&output=csv’)
do |http|
csv = http.read
end
puts “geo_code=#{csv}”
–
arton [email protected]
Thanks for the snippet and alternative solution.