Dan Zwell
12/24/2007 8:42:00 AM
Pradeepta Swain wrote:
>>> require 'net/http'
>>> Net::HTTP.start('www.rubyinside.com') do |http|
>>> req = Net::HTTP::Get.new('/test.txt')
>>> puts http.request(req).body
>>> end
>> req = http.get('/test.txt')
>>
>> You have to use the http connection to make the GET request.
>
> Still getting the same errors ,i am using ruby 1.8.4 in windows XP
> platform
> please help me out !can You please send the full code 2 make a
> connection
It works for me, as written, and I'm using ruby 1.8.6. I believe the API
for net/http changed a little between versions. I don't remember the
exact change, but try this variation:
require 'net/http'
Net::HTTP.start('www.rubyinside.com') do |http|
res = http.get('/test.txt')
puts res.body
end
Also try ".get2" instead of ".get". Good luck.