From: James Herdman Date: 2008-11-06T01:29:11+09:00 Subject: Re: What's the Best Way to Mimic an HTTP Request? ------=_Part_4817_6064596.1225902647769 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Is there a Ruby front end for Curl? James On Wed, Nov 5, 2008 at 11:24 AM, Daniel Miessler wrote: > I'm trying to write a tool that will take a domain as an argument and > make a request to http://onsamehost.com and then capture the list of > domains that share that same IP. I want to parse out those IPs and put > them into an array that I can print to a file later. > > Here's the code I'm trying to use: > > -- > require 'net/http' > require 'uri' > > PATH = '/query.jsp' > USERAGENT = 'Opera' > HOST = 'onsamehost.com' > > @http = Net::HTTP.new(HOST, 80) > > resp, data = @http.get2(PATH, {'User-Agent' => USERAGENT}) > > puts resp > puts data > -- > > The problem is that I keep getting a redirect > (#), which doesn't happen when I > make the request from a regular browser. > > So I sniffed the regular request with wireshark, and a browser sends a > bunch of additional headers when it makes the request. Cookies, > referrer, etc. > > Are any of these headers more necessary than others, and is there a > preferred way to send the headers using Ruby? > > Thanks for any thoughts... > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_4817_6064596.1225902647769--