Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

STUCK on www::mechanize ->get()

by smackdab (Pilgrim)
on Mar 01, 2004 at 22:13 UTC ( #333073=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: suck on www::mechanize question
in thread can't get www::mechanize to work on a web site

Thanks again for the help

I tried your string 200 times w/o success and it works every time in the browser...Don't know what I could be doing wrong...

I don't think it is the lyrics web site as the first ->get() works, it is just the 2nd one that fails...

The link that failes in www:mechanize is:

This URL works in my browser always...

Here is my complete test program incase someone else wants to give it a try ;-)

use WWW::Mechanize; use URI::URL; use strict; use warnings; my $artist = 'The Beatles'; my $title = 'Hey Jude'; my $mech = WWW::Mechanize->new(autocheck=>1); #$mech->agent_alias('Windows IE 6'); my $search = join("+", split(/ /, $artist)) . "+" . join("+", split(/ +/, $title)); print "search=" . "$search" . + "\n"; $mech->get("$search"); $mech->success() or die "Can't get the search page\n"; $mech->follow_link(text=>"Hey Jude"); #$mech->follow_link(n=>6); $mech->success() or die "Can't find lyrics page\n";

Replies are listed 'Best First'.
Re: STUCK on www::mechanize ->get()
by leira (Monk) on Mar 01, 2004 at 22:30 UTC
    Your script works for me as often as following the like works for me in a browser.

    I'd suggest that you try to get some more information about what's going on. Instead of just die-ing after a failure, you might try printing out $mech->status and/or $mech->content to see if that sheds any light on what's going on.

    Sorry I can't be of more help.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://333073]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2018-06-23 00:23 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.