Hi All,
I am currently trying to find the best way to log into a web page using a username/password to create a cookie. This will then enable me to access a webpage within that site and obtain the source code from it for my use.
Currently I have used the following:
#include <IE.au3> #Include <String.au3> #include <Array.au3> ; login and user status URLs $loginurl = 'http://localhost:8080/TestSite/checkLogin.jsp?uid=bob&pwd=bob' $processurl = 'http://localhost:8080/TestSite/UserStatuses.jsp' ; Register IE error handler ; Create the webpage and login to test site then close the webpage to create cookie ; Input element commands for login page ; This is old code i was using to input username/password into fields. ;Local $oForm = _IEFormGetObjByName($oIE, "frmLogin") ;Local $oText = _IEFormElementGetObjByName($oForm, "uid") ;_IEFormElementSetValue($oText, "bob") ;Local $oText = _IEFormElementGetObjByName($oForm, "pwd") ;_IEFormElementSetValue($oText, "bob") ;_IEFormSubmit($oForm) ;Sleep(5000) ;$processSource = _INetGetSource($processurl, 'True') ; Create webpage navigate to user status and read the source. Close the page
This I've noticed opens an instance of Internet Explorer to perform the work which obviously can be a bit resource intensive.
I'd like to find another way of doing this, is there such a way to just send a webpage the revelant url with login details to create a cookie to then allow me to just navigate to collect the source from my users page?
I've tried to use _INetGetSource($myURL, 'true') to get the source which works fine but of course I cannot use this unless I have a nice way of passing the login details to the first page to give me access to this second page.
Any ideas??
Kind regards,
Rob