8 posts in this topic
I was playing around with _INetGetSource(), and just seeing how it returned the bytes. It doesn't seem to return what I would expect, though. For example, I loaded up http://asdf.com/aboutasdf.html, and viewed the page source. Copy/ pasted that into a Notepad++ document, and I get a length of 2,481 characters > 2,481 bytes. When I do:
#include-once #include <Inet.au3> Global $sSource, $sSite = "http://asdf.com/aboutasdf.html" Global $iBytes $sSource = _INetGetSource($sSite) ;Get the page source for the account If Not @error Then ;As long as nothing goes wrong $iBytes += @extended ;Get number of bytes returned MsgBox(0, '', $iBytes & @CRLF & $sSource) ;Number of bytes, and the source ClipPut($sSource) Exit EndIf I get a return of 2,391 bytes (missing 90 bytes) from the @extended when I run _INetGetSource(). If I put the page source into my clipboard and paste that into the Notepad++ document, I still get 2,479 (it removed the top blank line that I get when selecting all from the page source in my browser). So the source that I copy from my browser, and that AutoIt puts in my clipboard is ~2,480 bytes. So, why is the @extended returning 2,391? Maybe I'm just missing something.
On just http://asdf.com/ it returns 1,892, which I get when copy/pasting as well, from the script and from the browser.
I'm trying to download a file from our server at work which requires a login.
InetGet is not working so I was looking round for another method.
I came across winhttp.au3 but it seems like this is not shipped with the Autoit ZIP I have. (v3.3.14)
Anyone have any ideas of where to get it, because I can't find it.
I also searched the forum, thinking it was trancexx who made it. (maybe I'm wrong here....)
Or is it obsolete and is there another / better way?
Good Morning All AutoIT Gurus,
#include <Inet.au3> $OpenHTML01 = _INetGetSource("https://get.adobe.com/flashplayer/") MsgBox (0, "", $OpenHTML01) A typical page response would include...
... within the <div id="autoSelectedVersion"> tag.
UPDATE: I believe it's this file that determines what OS, language, x32, x64, browser, etc that you are using and then reports it back...
It is the second time I am running to this problem again. First time I used simple form fill function from winhttp.au3. And I added a sleep between logins to make it work but this solution sucks.
So I am wondering again, is there an other solution to perform a log in on website other than simple form fill?
I just want to check credentials so I need to perform log in and then check for the username in the results.
Here is an example with simple form fill
#include "WinHttp.au3" Global $sRead, $hOpen, $hConnect Global $sUsername, $sPassword, $sName Global $sUrl = "https://www.facebook.com/" Global $sUserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)" $hOpen = _WinHttpOpen($sUserAgent) $hConnect = _WinHttpConnect($hOpen, $sUrl) $sRead = _WinHttpSimpleFormFill($hConnect, _ Default, _ "login_form", _ "name:email", $sUsername, _ "name:pass", $sPassword) If @error Then MsgBox(0, "Error", "Error: " & @error) ElseIf StringInStr($sRead, $sName) = True Then MsgBox(0, "", $sName & "'s credentials are correct.") Else MsgBox(0, "", "Wrong credentials, please try again.") EndIf _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen)
I am trying to make an auto log in script that will log in on our server with all the accounts of the people working on our domain read from the database(arround 20 accounts). The reason for this is everyone to recive update e-mail.
We recive update e-mail with the latest updates everytime time we log in so that is the reason that i am creating this.
Here is a small reproducer:
#include "WinHttp.au3" OnAutoItExitRegister("_sExit") Global $sRead, $hOpen, $hConnect Global Const $sUsername = ["name1", "name2", "name3"] Global Const $sPassword = ["pass1", "pass2", "pass3"] Global Const $sUrl = "https://www.myServer.com/" Global Const $sUserAgent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)" Local $a Local $b $hOpen = _WinHttpOpen($sUserAgent) $hConnect = _WinHttpConnect($hOpen, $sUrl) For $i = 0 To UBound($sUsername)-1 $a = $sUsername[$i] $b = $sPassword[$i] $sRead = _WinHttpSimpleFormFill($hConnect, _ Default, _ "login_1", _ "name:name", $a, _ "name:pass", $b) If @error Then ConsoleWrite(@error & @LF) Else If StringInStr($sRead, $a) Then ConsoleWrite($a & " succesfully logged in." & @LF) EndIf Next Func _sExit() _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) EndFunc If i put the $hOpen and $hConnect within the For/Next loop it will work but it will take more than 1 min to log in on our server with all the accounts.
If not it won't work for all the accounts. If i use $hOpen and $hConnect only once then the server will fire error after 4-5 log ins and the winhttpsimpleformfill function will return that there are no forms, @error 1.
Any other way to perform a log in without filling the form with data and submitting it?