# Nuby Http question

**URL:** <https://rubytalk.org/t/nuby-http-question/3628>\
**Category:** ruby-talk\
**Created:** [15 December 2002 07:25 UTC](https://rubytalk.org/t/nuby-http-question/3628 "2002-12-15T07:25:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ot\_Ratsaphong](https://avatars.discourse-cdn.com/v4/letter/o/a6a055/32.png) [@Ot\_Ratsaphong](https://rubytalk.org/u/Ot_Ratsaphong)\
**Post date:** [15 December 2002 07:25 UTC](https://rubytalk.org/t/nuby-http-question/3628/1 "2002-12-15T07:25:31Z")

</div>

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](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](http://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

---

<div class="post-metadata">

**Author:** ![ts1](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@ts1](https://rubytalk.org/u/ts1)\
**Post date:** [15 December 2002 11:54 UTC](https://rubytalk.org/t/nuby-http-question/3628/2 "2002-12-15T11:54:18Z")

</div>

> [http://fs.tradingroom.com.au/tpl/investments/tr\_cur\_price\_hist\_csv.isam?code](http://fs.tradingroom.com.au/tpl/investments/tr_cur_price_hist_csv.isam?code)  
> =CVS

> &nbsp;&nbsp;&nbsp;&nbsp;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

&nbsp;&nbsp;&nbsp;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

---

<div class="post-metadata">

**Author:** ![Ot\_Ratsaphong](https://avatars.discourse-cdn.com/v4/letter/o/a6a055/32.png) [@Ot\_Ratsaphong](https://rubytalk.org/u/Ot_Ratsaphong)\
**Post date:** [15 December 2002 20:44 UTC](https://rubytalk.org/t/nuby-http-question/3628/3 "2002-12-15T20:44:18Z")

</div>

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
