Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: LWP::UserAgent vs WWW::Mechanize

by jcdento (Novice)
on Jun 13, 2008 at 16:00 UTC ( [id://691936]=note: print w/replies, xml ) Need Help??


in reply to Re: LWP::UserAgent vs WWW::Mechanize
in thread LWP::UserAgent vs WWW::Mechanize

yes, sorry i meant LWP::UserAgent. The thing is, i am using identical methods in both scripts, and lwp is working, and mech isnt. My objects are:
y $agent = LWP::UserAgent->new(cookie_jar => HTTP::Cookies->new, reque +sts_redirectable => [ 'GET', 'HEAD', 'POST' ]); $agent->agent( 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8 +.1.14) Gecko/20080404 Firefox/2.0.0.14'); $agent->default_header('Accept' => "text/xml,application/xml,applicati +on/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", 'Accept-Language' => "en-us,en;q=0.5", 'Accept-Charset' => "ISO-8859-1,utf-8;q=0.7,*;q=0.7", 'Keep-Alive' => "300", 'Connection' => "keep-alive");
and
my $agent = WWW::Mechanize->new(autocheck=>1, agent=> 'Mozilla/5.0 (Wi +ndows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/ +2.0.0.14'); $agent->max_redirect(100); $agent->default_header('Accept' => "text/xml,application/xml,applicati +on/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", 'Accept-Language' => "en-us,en;q=0.5", 'Accept-Charset' => "ISO-8859-1,utf-8;q=0.7,*;q=0.7", 'Accept-Encoding' => "gzip,deflate", 'Keep-Alive' => "300", 'Connection' => "keep-alive", 'TE' => "");

Replies are listed 'Best First'.
Re^3: LWP::UserAgent vs WWW::Mechanize
by pc88mxer (Vicar) on Jun 13, 2008 at 16:34 UTC
    WWW::Mechanize's version of ->request modifies the request before issuing it, and that could be the problem. Try this:
    $agent = WWW::Mechanize->new(...); ...set up $agent... $agent->LWP::UserAgent::request($form->click);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://691936]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-25 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found