Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Unable to access restricted URL resource (GET) 302 redirect msg - using HTTP::Request::Generator

by Corion (Patriarch)
on Oct 10, 2020 at 18:51 UTC ( [id://11122672]=note: print w/replies, xml ) Need Help??


in reply to Unable to access restricted URL resource (GET) 302 redirect msg - using HTTP::Request::Generator

HTTP::Request::Generator is for generating HTTP requests, for example for scanning multiple hosts for a set of URLs. It is not for executing the sequence of requests and certainly not for following requests.

LWP::UserAgent can automatically/transparently follow 302 requests, but I don't know if it also transforms a POST request into a GET request after redirect. If not, you will have to do that yourself, but you will have to do that with any kind of HTTP request, no matter how you got it (manually, or from HTTP::Request::Generator). See the response_redirect handler for where you can implement the change from POST to GET on redirect.

Update: If you want to have your Perl script act more like a browser, consider using WWW::Mechanize, which extends LWP::UserAgent to act more like a browser.

  • Comment on Re: Unable to access restricted URL resource (GET) 302 redirect msg - using HTTP::Request::Generator

Replies are listed 'Best First'.
Re^2: Unable to access restricted URL resource (GET) 302 redirect msg - using HTTP::Request::Generator
by tobyink (Canon) on Oct 10, 2020 at 21:01 UTC

    "LWP::UserAgent can automatically/transparently follow 302 requests, but I don't know if it also transforms a POST request into a GET request after redirect."

    For HTTP 302 and HTTP 303 redirects, it transforms non-GET/HEAD requests into GET requests upon redirection.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11122672]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-24 16:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found