The Spark Between

Thoughts, Projects, Happenings, Ideas
  • Home
  • About
  • SmartBox
  • LiveTrip
  • Calendar
  • Photos

Why are all my LWP POST requests returning status 302?

Colin M | September 8, 2007 | 1:01 pm

Quick tip for PERL users:

LWP does not redirect on POST requests by default. If you are trying to POST to a page which replies with a redirect, e.g., authenticating with a webform or somesuch, you need to enable redirects via this line:

push @{ $ua->requests_redirectable }, ‘POST’;

You can also do this by hand, ala:

$resp = $ua->post(…);
if ($resp->is_redirect) {
$resp = $ua->get($resp->header(“Location”));
}

Originally found via: this news post

Comments
No Comments »
Categories
Uncategorized
Comments rss Comments rss
Trackback Trackback

Next Entries »

Random Quote

Cannot find the random quotes plugin. If you have installed it check if you have activated it. If you have not installed it, you can download it from here.

Blogroll

  • Angela
  • Ashley
  • Jared
  • Jeni
  • Jon
  • Paul
  • Scott

Archives

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox