Dear wise monks,

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:

http://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
Can anyone of You please send some enlightenment? Thanks, MC

In reply to www::mechanize problem with url / redirect by McSvenster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.