McSvenster has asked for the wisdom of the Perl Monks concerning the following question:
I am - have to - working with really bad software... Even worse, the software is behind a reverse proxy, so redirects are really complex. I am trying to write some test scripts with www::mechnize. As the redirects happen through javascript I parse the content to follow the redirections:
$agent->get($url); $agent->form_number(1); $agent->field('vl(freeText0)', $suchwort); $agent->click(); $agent->content =~ m/\'\/goto\/(.*)\'/; print "Der Link: $1\n\n"; $agent->get( $1);
As You can see I print the resulting link for my analysis. Unfortunately my agent seems not to use the link provided in $1. Here the output:
Der Link: http://www.library.ethz.ch:80/search/action/login.do?afterPD +S=true&vid=DADS&vid=DADS&dscnt=1&targetURL=http%3A%2F%2Fwww.library.e +thz.ch%2Fsearch%2Faction%2Fsearch.do%3Fdscnt%3D0&frbg=&tab=default%5F +tab&dstmp=1356212616435&srt=rank&ct=search&mode=Basic&dum=true&indx=1 +&vl%28freeText0%29=Ajax&cmslang=ger-DE&fn=go&pds_handle=GUEST Error GETing http://www.library.ethz.ch/search/action/http%3A%2F%2Fwww +.library.ethz.ch%2Fsearch%2Faction%2Fsearch.do%3Fdscnt%3D0dscnt=2&frb +g=&tab=default%255Ftab&dstmp=1356212617376&srt=rank&ct=search&mode=Ba +sic&dum=true&indx=1&vl%28freeText0%29=Ajax&fn=go&vid=DADS&cmslang=ger +-DE&fromLogin=true&fromLogin=true: Not Found at mech_auto.pl line 24
I have no idea what is happening here! It looks like there is a link and a redirect mixed up. The first link works without a problem in a browser and redirects to:
Can anyone of You please send some enlightenment? Thanks, MChttp://www.library.ethz.ch/search/action/search.do?&dscnt=1&frbg=&tab= +default_tab&dstmp=1356213423770&srt=rank&ct=search&mode=Basic&dum=tru +e&indx=1&fromLogin=true&vl(freeText0)=Ajax&vid=DADS&fn=search&cmslang +=ger-DE
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: www::mechanize problem with url / redirect
by Anonymous Monk on Dec 22, 2012 at 22:08 UTC | |
by McSvenster (Novice) on Dec 22, 2012 at 22:27 UTC | |
by McSvenster (Novice) on Jan 03, 2013 at 06:55 UTC |