> -----Original Message-----
> From: Bostjan JERKO [mailto:Bostjan.Jerko / socgen.com]
> Sent: Thursday, January 18, 2001 4:48 PM
> To: ruby-talk ML
> Subject: [ruby-talk:9508] http read
> 
> 
> I want to write a small script to read html data from http server.
> I wrote/copied something like this, but it doesn't seem to work.
> 
> require "socket"
> 	port = 80
> 	s=TCPSocket.open("192.168.1.1",port)
> 	 print s.read
> s.close
> 
> I guess read is not proper method to use, but I just can't find out
> which method would be proper.

Look at this:

require 'socket'

host = 'www.poseti.com'
port = 80
begin
	s = TCPSocket.open host, port
	s.write "GET http://#{host}/\n\n"
	print s.read
ensure
	s.close
end

Aristarkh A Zagorodnikov, W3D Group
http://www.w3d.ru /// xm / w3d.ru /// ICQ UIN 36987938