#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Netherlands
    Posts
    3
    Rep Power
    0
    When a site uses an ASP form using the "Post" method, I cannot connect to the site using an URL parsing the parameters with ? and &.

    Does anybody know how to login to an ASP-site using this method for login-checking (for example from an PERL-script)?

    Erwin
  2. #2
  3. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Start here -> http://www.devshed.com/Talk/Forums/F...ML/000387.html

    Please note that many sites accept form post only from their own site by checking the page referal.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Location
    Netherlands
    Posts
    3
    Rep Power
    0
    FreeBSD,

    Took me some time to install ActivePerl on the Company Laptop, but finally ready for a testdrive...

    Used your sample on a local .asp simulated ASP Page, which works fine:

    Code:
    # script.cgi ###############################
    #!/usr/local/bin/perl

    use LWP::UserAgent;
    my $URL = "http://localhost/eunits/login.asp";
    my $ua = new LWP::UserAgent;
    $ua->timeout(30);
    $ua->agent("AgentName/0.1 " . $ua->agent);
    my $req = new HTTP::Request POST => $URL;
    $req->content_type('application/x-www-form-urlencoded');
    $req->content("BegPage=login.htm&PartID=123123123&EmpPIN=1234&Graphics.x=72&Graphics.y=5");
    my $res = $ua->request($req);

    if ($res->is_success) {
    my $content = $res->content;
    &output_status($content);
    exit;
    }
    else {
    &output_status("is_success Failed");
    exit;
    }

    sub output_status {
    my (@messages) = @_;
    print "Content-type: text/htmlnn";
    my $message;
    foreach $message (@messages) {
    print $message;
    }
    }
    ############################################

    # login.asp ###############################
    <%@ LANGUAGE="VBSCRIPT" %>

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
    <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
    <TITLE>Login.htm</TITLE>
    </HEAD>
    <BODY TopMargin="0" Leftmargin="0">
    <%For each i in request.form
    response.write i & " = " & request.form(i) & "<br>"
    Next
    %>

    </BODY>
    </HTML>

    Result:
    =======
    C:WINDOWSDESKTOPperl>perl script
    Content-type: text/html

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
    <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">

    <TITLE>Login.htm</TITLE>
    </HEAD>
    <BODY TopMargin="0" Leftmargin="0">
    BegPage = login.htm<br>PartID = 123123123<br>EmpPIN = 1234<br>Graphics.x
    = 72<br>Graphics.y = 5<br>

    </BODY>
    </HTML>

    So the local listener page is able to interpret the posted object.

    When I run the script to the actual page which is located at "https://eunits.ac.com/login.asp" (with correct data), I get result:

    C:WINDOWSDESKTOPperl>perl script
    Content-type: text/html

    is_success Failed

    Any suggestions on how to get the actual result from the login.asp page returned?
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    Secure pages work differently. Have a look at -> http://www.devshed.com/Talk/Forums/F...ML/001630.html

IMN logo majestic logo threadwatch logo seochat tools logo