Jump to content

How to script a browser login?


Nitin
 Share

Recommended Posts

I'm new with autoit so plz just point me in the right direction ....

the thing is that whenever i connect to my university Wifi lan ... i have to login from a browser page before i can access the internet ...

and then i have to re-login every 37 minutes or so ... ... so i need a script that can act as a web browser ... access the page and send the login data...

how do i go about it?

p.s. the page is simple http not the secure type

Link to comment
Share on other sites

Link to comment
Share on other sites

Like this, for example.

#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "your username here"
$password = "your password here"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")
Link to comment
Share on other sites

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
_HTTPRequest($oHTTP, "POST", "http://site.com/login.php", "username=wut&password=kthx")

Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "")
    $oHTTP.Open($oMethod, $oURL, False)
    If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
    $oHTTP.Send($oData)
    Return $oHTTP.ResponseText
EndFunc

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...