From: "Cédric Finance" Date: 2007-11-09T03:26:44+09:00 Subject: Re: Faking the refering page with Mechanize ------=_Part_6731_30106183.1194546404829 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline #irb irb(main):001:0> require 'mechanize' => true irb(main):002:0> require 'logger' => true irb(main):003:0> logger = Logger.new $stdout ; "" => "" irb(main):004:0> agent = WWW::Mechanize.new ; "" => "" irb(main):005:0> agent.log = logger ; "" => "" irb(main):006:0> ref = WWW::Mechanize:: Page.new("http://www.mininova.org",{ 'co ntent-type' => 'text/html' }) ; "" => "" irb(main):007:0> agent.get "http://google.com", ref ; "" I, [2007-11-08T19:25:06.144484 #21091] INFO -- : Net::HTTP::Get: / D, [2007-11-08T19:25:06.144937 #21091] DEBUG -- : request-header: accept-language => en-us,en;q0.5 D, [2007-11-08T19:25:06.145032 #21091] DEBUG -- : request-header: accept => */* D, [2007-11-08T19:25:06.145106 #21091] DEBUG -- : request-header: accept-encoding => gzip,identity D, [2007-11-08T19:25:06.145178 #21091] DEBUG -- : request-header: user-agent => WWW-Mechanize/0.6.5 (http://rubyforge.org/projects/mechanize/) D, [2007-11-08T19:25:06.145253 #21091] DEBUG -- : request-header: referer => http://www.mininova.org Which version of mechanize do you use? On Nov 8, 2007 5:44 PM, Ehud Rosenberg wrote: > In the following line: > ref = > WWW::Mechanize::Page.new("http://www.mininova.org',{'content-type'= > >'text/html' > }) > the second apostrophe after mininova.org does not match the first one (" > vs. '). > > When I try to run it with both sides contained by a double quote, i get > a message saying: > NoMethodError: undefined method `path' for > "http://www.mininova.org":String > > That's why I used the URI.parse method before. > this is really strange, are you sure that's the exact syntax you used? > > Thanks! > Ehud > -- > Posted via http://www.ruby-forum.com/. > > ------=_Part_6731_30106183.1194546404829--