From: Tom Bombadil Date: 2007-06-12T00:08:33+09:00 Subject: Re: Problem with getting info from several websites ------=_Part_107152_13259956.1181574514139 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, To open and write sth into a file I created: File.open("bid.txt", "w+") do |file| file.write("Howdy!") end Though, how can I pass the content of the div id = "vulnerability" and how can I create a file for each id separately? Thanks!! On 6/10/07, George Malamidis wrote: > > Hello, > > Does this work for you? > > %w(rubygems hpricot open-uri).each { |e| require e } > > (1..10).each do |id| > doc = Hpricot(open("http://www.securityfocus.com/bid/#{id}")) > p (doc/'#vulnerability').inner_html > end > > George > > On 10 Jun 2007, at 10:26, Tom Bombadil wrote: > > > Hi there, > > > > I'm trying to get data from a couple of websites at the same time > > by using: > > > > (1..10).each { |p| print p} # should get the content from the > > pages with > > the id's 1 to 10... > > > > # load the Securityfocus home page (id 1 to start) > > doc = Hpricot(open("http://www.securityfocus.com/bid/1 > www.securityfocus.com/bid/715> > > ")) > > > > # get the content of the div id ="vulnerability" > > p =(doc/'#vulnerability').inner_html > > > > # prints div id = 'vulnerability' > > puts p > > > > Must I use an array? > > > > Thanks, > > Tom > > > ------=_Part_107152_13259956.1181574514139--