Posted on 2006-02-17 02:51:25-08 by weilies
Prob: URL remain the same.
hi, i think i better report my question here again :)

I hope to retrieve the url redirected by an url i pass in ($agent->get( $url );) but seems it keep on return " http://abc.com/c.pl", since it should return "http://abc.com/z.pl". i had checked on c.pl and run it manually. it does redirected to z.pl.

my another question is :"Can i really use this module to accomplish my task? coz the abc.com is reside in client server, and i have totally no control on it. I just know they will redirect to another site in real life. In short, i CANT modify the c.pl and z.pl. What my script does, is just retrieve the redirected url to do validation"

My Code:
#!/usr/bin/perl
use LWP::LastURI;
use WWW::Mechanize;
use HTTP::Headers;


my $agent = new WWW::Mechanize;
$url = " http://localhost/c.pl?a=0";
$link = $agent->get( $url );
my $redirected_final = LWP::LastURI::last_uri;
print $redirected_final;


# end_of_my_code

Thanks for helping
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.