Find the answer to your Linux question:
Results 1 to 3 of 3
Hi. I am trying to access a website with which I am registered to, and the script that I want to develop will download certain pages from the site. All ...
  1. #1
    Just Joined!
    Join Date
    Feb 2009
    Posts
    4

    Logging into asp form in BASH... help needed

    Hi. I am trying to access a website with which I am registered to, and the script that I want to develop will download certain pages from the site. All is fine except that I am having issues with logging into the site via BASH. I've tried wget, with the --user and --pass options but they don't seem to work. Here's what I know about the login page...

    It's written in ASP
    the field names that I want to populate are textLogin and Password1
    The code of the form is below.

    Code:
    <form method="post" action="Login.asp?Redirect=gpro.asp" ID="Form1">
    Any pointers to help me out will be greatly appreciated.

  2. #2
    Just Joined! AdmiralBeotch's Avatar
    Join Date
    Feb 2009
    Location
    Las Vegas, NV
    Posts
    17
    get the firefox plugin "http live headers" and watch the login process via a browser.

    Then use curl with --headers option to simulate the request from the command line. It could turn out to be easy, or it could be a bit more complex due to session variables that must be persistent across GET/POSTs.

  3. #3
    Just Joined!
    Join Date
    Feb 2009
    Posts
    3
    I wrote a similar script in Perl which you might find easier. You can use WWW:Mechanize
    Note: I had to use frames in mine, but that can easily be taken out

    Code:
    #!/usr/bin/perl
    use strict;
    use WWW::Mechanize;
    use WWW::Mechanize::Frames;
    use HTTP::Cookies;
    my $outfile = "out.htm";
    my $url = "http://www.website.com";
    my $mech = WWW::Mechanize::Frames->new();
    $mech->cookie_jar(HTTP::Cookies->new());
    my $username = "username";
    my $password = "password";
    $mech->get($url);
    $mech->form_name('form_login_name');
    $mech->field(USER => $username);
    $mech->field(PASSWORD => $password);
    $mech->click();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...