Hi guys,

I am new to this list, LWP in general, and only been using perl for a year
or so...
so please bare with me if I forgot a place to RTFM..

I am fetching a page with LWP::Simple

use LWP::Simple qw(getstore);
my $result = getstore( $page, $file);

now $page normally is just another perl script that prints HTML depending on
its query string..(always using GET)
whick works great.

but in some instances, this perl script uses a:

print "location: $another_page\n\n";


to redirect the browser to another location entirely, along with its query
string..


The problem is that LWP::Simple seems to stop at the redirect.. perhaps
catching the location header instead of following it..

to give alittle more detail I have setup a test scenario to replicate the
problem..

it has three scripts.

pagegrabber.pl->redirect.pl->formtester.pl

pagegrabber contains the LWP::Simple code and it is supposed to fetch the
results of redirect.pl.
redirect just contains a print location redirect, and its redirecting to
formtester.pl.
formtester just contains some code to print out the query string key/values
and some useragent detect code.

if redirect.pl is called directly, it correctly displays the formtester
output.
if pagegrabber.pl is called, it just displays a blank page.. no error, no
output.

Now my docs searching shows some redirect methods in UserAgent:
$ua->requests_redirectable( );
$ua->redirect_ok($prospective_request)

but I have no idea if they equate to Simple (getstore) and if it does, how
to set it up..
Is there a better way then getstore to fetch a page and save it to a file?

Is there anyway I can get getstore to follow any redirects and grab the
final HTML???


Any tips would be greatly appreciated.


kindest regards

Frank







Reply via email to