I am a Ruby Nuby and am seeking some assistance.
I am trying to write a small program to download some historical end of day
stack data.
Using a browser, the URL would be:
http://fs.tradingroom.com.au/tpl/investments/tr_cur_price_hist_csv.isam?code
=CVS
The program I’m using is an example from the net/http.rb:
require ‘net/http’
http = Net::HTTP.new(‘fs.tradingroom.com.au’, 80)
using block
puts "Opening file: testCVS.csv"
File.open( ‘testCVS.csv’, ‘w’ ) {|f|
http.post( ‘/tpl/investments/tr_cur_price_hist_csv.isam’,
‘query=subject&code=CVS’ ) do |str|
f.write str
end
}
Unfortunately this program only returns the first line of the file, which is
only the headings. Could show me how I can get the rest of the file?
Thanks,
Ot Ratsaphong
ts1
(ts)
2
http://fs.tradingroom.com.au/tpl/investments/tr_cur_price_hist_csv.isam?code
=CVS
http.post( '/tpl/investments/tr_cur_price_hist_csv.isam',
'query=subject&code=CVS' ) do |str|
You don't use the same URL, just write
http.post( '/tpl/investments/tr_cur_price_hist_csv.isam', 'code=CVS')
Unfortunately this program only returns the first line of the file, which is
only the headings. Could show me how I can get the rest of the file?
This is because you have added 'query=subject' to your URL
Guy Decoux
Guy,
You are a life saver!
Merci beaucoup!!!
Ot Ratsaphong
You don’t use the same URL, just write
http.post( ‘/tpl/investments/tr_cur_price_hist_csv.isam’, ‘code=CVS’)
Unfortunately this program only returns the first line of the file,
which is
···
only the headings. Could show me how I can get the rest of the file?
This is because you have added ‘query=subject’ to your URL
Guy Decoux