subdian has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks I request your wisdom on a matter of perl. I have a script which requests a webpage from a form, and then processes that webpage. However, if the response code is a 3xx , my script automatically redirects, and pulls back the code of the redirected page, and not the original page. How can I get my hands on the code of the original non redirected page - i.e. just ignore the 3xx redirect Thanks in advance

Replies are listed 'Best First'.
Re: Ignore 3xx redirects
by dorward (Curate) on Jul 06, 2006 at 15:32 UTC

    Somewhere there is some code that is causing the script to follow the redirect. Turn it off.

    (Its rather hard to be more specific then that without knowing what code you are using.)

    If, for instance, you were using LWP::UserAgent, then we might suggest you:

    $ua->requests_redirectable ([]);
    As the manual suggests.
      Yes apologies for not being more specific - (long code, not sure which bit doing what, and didn't want to post a heap of irrelevant stuff)

      Anyway without being 'more specific' you were able to hit the nail on the head

      $ua->requests_redirectable ([]);
      was EXACTLY what I needed.
      Many thanks dorward.
Re: Ignore 3xx redirects
by cowboy (Friar) on Jul 06, 2006 at 15:35 UTC

    Please read: How (Not) To Ask A Question

    We can't provide much help at all unless you give us more information. How is your script grabbing the page? What does your existing code look like?