From: Diego Suarez Date: 2007-09-13T21:56:50+09:00 Subject: Re: screen scraping programaticprogrammer.com ? ------=_Part_11464_28543629.1189688180274 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I've just checked it, and the code on pragmaticprogrammer.com (you made a typo, probably) returns a 200 OK, and the program works as expected. It could be the typo, but programmaticprogrammer does not exist for me, and you're getting a 302 (it's a redirect to another page) so I don't know what's happening exactly. Take a look on HTTP response codes if the problem wasn't the URL. Regards. Diego. On 9/13/07, 7stud -- wrote: > > The following is from "Programming Ruby 2nd" p.133: > > ---- > require "net/http" > > h = Net::HTTP.new("www.programaticprogrammer.com", 80) > response = h.get("/index.html") > > if response.message == "OK" > puts response.body.scan(/ end > ---- > > It doesn't work: nothing is printed. So, I modified it a little: > > ----- > require "net/http" > > h = Net::HTTP.new("www.programaticprogrammer.com", 80) > response = h.get("/index.html") > > puts response.message > puts response.code > > if response.message == "OK" > puts "*" > puts response.body.scan(/ end > ----- > > and the output was: > > Found > 302 > > > I clicked a link on their home page and tried to access the page that > was displayed, but I got the same result. What am I doing wrong? > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_11464_28543629.1189688180274--