[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    nuby: can't get an image via http
From:       Guido de Melo <guido.de-melo () informatik ! uni-ulm ! de>
Date:       2004-01-27 9:50:01
Message-ID: 4016343b () news ! uni-ulm ! de
[Download RAW message or body]

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.dll?id=NCZ&PASS=NewCZPrtT&X=129374719&Y=103205254&LV=3&WID=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.dll?id=NCZ&PASS=NewC \
ZPrtT&X=129374719&Y=103205254&LV=3&WID=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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic