Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to login into a passworded webpage 1

Status
Not open for further replies.

skits2

Technical User
Sep 30, 2006
5
0
0
US
Hello,

I am trying to login a passworded webpage. The loging form for the webpage is
Code:
<form id="form1" name="form1" method="post" action="[URL unfurl="true"]http://www.linkalizer.com/login.php?fn=http://www.linkalizer.com/welcome.php">[/URL]
            <p><strong><br />
              Login </strong>username

                <input name="user_box" type="text" id="user_box" />
            password

              <input name="pass" type="password" id="pass" />
                 &nbsp;
                 <input type="submit" name="Submit" value="Go &gt;" />
                 <br />
                 <a href="[URL unfurl="true"]http://www.linkalizer.com/pass_forgot.php">Forgot[/URL] password</a></p>
            </form>

I have been trying to login using the script
Code:
$mech->get("[URL unfurl="true"]http://www.linkalizer.com/welcome.php");[/URL]

## Log in.
$mech->set_fields(
user_box => 'username@user.com',
pass => 'password',
);
$mech->submit();

      
print $mech->uri;
my $url = $mech->uri;
$content = get($url)   || die "get: $!";

$count++;

open (OVERWRITE, ">link_2_me_$count.htm") or die "$! error trying to overwrite";
print OVERWRITE $content;

but have not had any luck. It always kicks me out to the error logging in page. Any suggestions on how I can change my script to log in?

Thanks
Scott
 
I'm guessing that you're using the Perl module but you don't say so. You should; it's tedious having to guess information you should be giving.

To solve your problem: replace your code:
Code:
my $url = $mech->uri;
$content = get($url)   || die "get: $!";
with:
Code:
$content = $mech->submit();
You're simply not submitting your data the way you're doing it.
 
Thank you for your help MOrac. I am indeed using I apologize for not including that information. Any questions I have in the future will be more thorough.

I do not know if that will fix my problem or not, but I will try it when I get home from work.

thanks again
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top