Jump to content
Can't remember your login details? Read more... ×
Sign in to follow this  
wilsontc

using curl to get my internet usage from my isp

Recommended Posts

Hello everyone,

 

I want to use command line curl to log into my ISP's members home page, and redirect the result to STDOUT. The page obviously uses SSL, but I don't know what else I need to do. Here is what the form looks like:

<form name="login_form" action="" method="POST" autocomplete="on">
<div id="mflogin">
  <div id="un">Username:
	<input name="login_name" class="tboxsize" />
  </div>
	<div id="pw">Password:
	  <input name="password" type="password" class="tboxsize" />
	</div>
	<div id="go">
	<input type="hidden" name="doLogin" value="1" />
	  <input name="submit" type="submit" value="Login" />
  </div>
  <div id="probtext"><a href="password_recover.php">Forgot your password?</a></div>
</div>
</form>

I am using curl like this:

curl -c cookies.txt -b cookies.txt -d login_name="myUser&password=myPass" -k https://www.exetel.com.au/members/home.php > exetel.html

But it doesn't seem to work. I don't think I need to use redirection because the form submits to it's own page.

 

If anybody wants the full page source, it can be found here: https://www.exetel.com.au/members/home.php

 

Any ideas?

Share this post


Link to post
Share on other sites

What do you mean by 'doesn't seem to work'? What output do you end up with in exetel.html?

 

I just had a look at the curl man page and it looks like you need to use -d for each query string pair. I.e. -d login_name=myUser -d password=myPass instead of -d login_name="myUser&password=myPass" (which looks like the "s are in the wrong place anyway).

 

But without knowing what's not working I have no idea if that's the problem.

Share this post


Link to post
Share on other sites

What do you mean by 'doesn't seem to work'? What output do you end up with in exetel.html?

 

I just had a look at the curl man page and it looks like you need to use -d for each query string pair. I.e. -d login_name=myUser -d password=myPass instead of -d login_name="myUser&password=myPass" (which looks like the "s are in the wrong place anyway).

 

But without knowing what's not working I have no idea if that's the problem.

Yes, I should have been clearer from the start. It returns the same form that is asking for the login details, so the log in failed.

 

According to the man page, -d's are joined with an &, so my syntax is correct, at least for my distribution of curl (whatever is on OS X 10.5.5). I'll try using separate -d's.

 

I guess what I really wanted to know is, am I going about this in the right way?

 

*edit* using two -d's still returns the same page.

Share this post


Link to post
Share on other sites

Have you included the hidden form field doLogin=1?

No I haven't. Hmm, I'll see if I can work out how to do that. Thanks.

 

 

edit:

Yes! That worked, thank you SledgY! All I needed to add was: -d doLogin=1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×