Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How to get back the url of a page

by xhunter (Sexton)
on May 16, 2007 at 17:11 UTC ( [id://615840]=note: print w/replies, xml ) Need Help??


in reply to How to get back the url of a page

$mech->uri works as you would like for me.

Would you like to provide more details on the error. What does line 194 of bot.pl look like?

Replies are listed 'Best First'.
Re^2: How to get back the url of a page
by cormanaz (Deacon) on May 16, 2007 at 20:42 UTC
    I tried $mech->uri() and it gave the original page, not the one redirected to. Sulfericacid wants the uri of the page mech winds-up on after processing any redirects.
      cormanaz is right. This image site sometimes redirects images to an IP address when the servers are getting high traffic. I need to be able to load the original image URL and detect whether or not it's going to redirect me. If so, I need to know what the address is of the image.

      This is my current set up.

      foreach my $pic (@pics) { my $mech = WWW::Mechanize->new(); $mech->agent_alias( 'Windows IE 6' ); $mech->get($pic); my $location = $mech->uri(); push(@final_pics, "$location"); print "\ntesting $pic with location $location"; }


      "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

      sulfericacid
        uri is always the location
        use strict; use warnings; use WWW::Mechanize; my $url = 'http://google.com'; my $mech = WWW::Mechanize->new(); warn $url; warn $mech->get($url); warn $mech->uri(); __END__ http://google.com at - line 9. HTTP::Response=HASH(0x1d7f160) at - line 10. http://www.google.com/ at - line 11.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-23 19:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found