G
Guido de Melo
Hi,
I want to download maps from chizumaru, they provide good digital maps
and I want to put them together so I get a big map of Tokyo for example.
Now wget works as it should:
wget -O test.png
'http://ras.chizumaru.com/ncg/tcmap....=650&HEI=680&SZ=PRT_T&TAB=live2003_scl&FUNC=2'
But I wanted to do this in Ruby so I tried this:
require 'net/http'
require 'uri'
# this works
Net::HTTP.get_print(URI.parse('http://ras.chizumaru.com/ncg/tcmap....=650&HEI=680&SZ=PRT_T&TAB=live2003_scl&FUNC=2'))
but then I have to redirect the output on the console. If I do it this way
mapfile = File.new("map.jpg", "w")
Net::HTTP.start('ras.chizumaru.com', 80) {|http|
response, data = http.post('/ncg/tcmap.dll',
'id=NCZ&PASS=NewCZPrtT&X=129374719&Y=103205254&LV=3&WID=650&HEI=680&SZ=PRT_T&TAB=live2003_scl&FUNC=2')
mapfile.puts data
}
the data doesn't get written. I also experimented with $defout and
$stdout, but I got nowhere, so I'm grateful if someone could offer me
advice on this one.
Happy rubying,
Guido
I want to download maps from chizumaru, they provide good digital maps
and I want to put them together so I get a big map of Tokyo for example.
Now wget works as it should:
wget -O test.png
'http://ras.chizumaru.com/ncg/tcmap....=650&HEI=680&SZ=PRT_T&TAB=live2003_scl&FUNC=2'
But I wanted to do this in Ruby so I tried this:
require 'net/http'
require 'uri'
# this works
Net::HTTP.get_print(URI.parse('http://ras.chizumaru.com/ncg/tcmap....=650&HEI=680&SZ=PRT_T&TAB=live2003_scl&FUNC=2'))
but then I have to redirect the output on the console. If I do it this way
mapfile = File.new("map.jpg", "w")
Net::HTTP.start('ras.chizumaru.com', 80) {|http|
response, data = http.post('/ncg/tcmap.dll',
'id=NCZ&PASS=NewCZPrtT&X=129374719&Y=103205254&LV=3&WID=650&HEI=680&SZ=PRT_T&TAB=live2003_scl&FUNC=2')
mapfile.puts data
}
the data doesn't get written. I also experimented with $defout and
$stdout, but I got nowhere, so I'm grateful if someone could offer me
advice on this one.
Happy rubying,
Guido