Advertisement

01.21.2008 at 04:13PM PST, ID: 23099828
[x]
Attachment Details

LWP and redirects

Asked by Marketing_Insists in Perl Programming Language

Tags: post

LWP with 'Object moved' redirect feedback

I'm attempting to authenticate to a website via LWP, and it's working, but some redirects are stalling the script process.  After successfully logging in with the code below, I get the feedback:
 
   <head><title>Object moved</title></head>
   <body><h1>Object Moved</h1>This object may be found <a HREF="options.asp">here</a>.</body>

Options.asp is indeed my destination page, and where I would end up with a regular browser, but I've no idea how to get their in LWP.  If I post to options.asp instead, I get the opposite, telling me the object maybe be found at logon.asp


Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
# working code
#!perl
use LWP;
use Crypt::SSLeay;
 
            $browser = LWP::UserAgent->new();
            $browser->timeout(20);     
 
            $response = $browser->post(
                "https://webpage/logon.asp",
                [
                    "userID"          => "user",
                    "password"        => "pass"
                ]
            );
 
print $response->content();
 
 
[+][-]01.21.2008 at 05:30PM PST, ID: 20711212

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: post
Sign Up Now!
Solution Provided By: Adam314
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628