Amit Bobade <amit.srpce / gmail.com> wrote: > >I am trying to deal with the http response. I am using following code to >do so. > ><code> > > require 'net/http' > require 'uri' > > def fetch(uri_str, limit = 10) > # You should choose better exception. > raise ArgumentError, 'HTTP redirect too deep' if limit == 0 > > response = Net::HTTP.get_response(URI.parse(uri_str)) > case response > when Net::HTTPSuccess then response > when Net::HTTPRedirection then fetch(response['location'], limit - >1) > else > response.error! > end > end > > print fetch('http://www.gosocially.com/index.php') > ></code> > >I am getting output: #<Net::HTTPFound:0x29b78f8> > >Please tell me what is the meaning of #<Net::HTTPFound:0x29b78f8> ? Did you read any of the documentation? Net::HTTP.get_response returns a response object, because an HTTP request returns several different kinds of things. What you are seeing there is the string representation of an object. Are you expecting to print the body of the web page? If so, then you should print response.body, not response. -- Tim Roberts, timr / probo.com Providenza & Boekelheide, Inc.