Search the Community
Showing results for tags '_winhttpsimpleformfill'.
-
Hi again, this is my last option to retrieve file from server via web. ; Initialize and get session handle $hOpen = _WinHttpOpen() _writeLog("return $hOpen:" &$hOpen) ; Get connection handle $hConnect = _WinHttpConnect($hOpen, $url, $INTERNET_DEFAULT_HTTPS_PORT) _writeLog("return $hConnect:" &$hConnect) ; Fill the login form: $check_login = _WinHttpSimpleFormFill($hConnect, _ $hOpen, _ "id1", _ "name:LoginForm[userName]", $userID, _ "name:LoginForm[password]", $password,_ "[IGNORE_CERT_ERRORS]") If @error Then _writeLog("login failed : " & @error) _writeLog("check login UIS" &$check_login) ; Close connection handle _WinHttpCloseHandle($hConnect) ; Open new connection handle $hConnect = _WinHttpConnect($hOpen, $url, $INTERNET_DEFAULT_HTTPS_PORT) $s_data = _WinHttpSimpleSSLRequest($hConnect,Default,$Download_url,Default,Default,Default,Default,2) ; BINARY ;$s_data = _WinHttpSimpleSSLRequest($hConnect, Default, $Download_url) _writeLog("return $s_data " &$s_data) ; Close connection handle _WinHttpCloseHandle($hConnect) ; Close session handle _WinHttpCloseHandle($hOpen) ; Open the file for writing (append to the end of a file) and store the handle to a variable. Local $hFileOpen = FileOpen($sFilePath, 18) If $hFileOpen = -1 Then _writeLog("An error occurred whilst writing the temporary file.") EndIf ;Write the data to the file FileWrite($hFileOpen ,$s_data) FileClose($hFileOpen) However it paused at _WinHttpSimpleSSLRequest before this received error: 1 $url = "https://192.168.10.167/ui/login" $Download_url https://192.168.10.167/ui/backup/files?3-1.ILinkListener-files-1-download Any idea?
- 1 reply
-
- winhttp.au3
- _winhttpsimpleformfill
-
(and 1 more)
Tagged with:
-
I have a pretty simple question (hopefully). Why am I getting a connection error and how do I fix it? Thanks. #include "WinHttp.au3" $sPage = "/clientdb/PropertySearch.aspx?cid=1" ; Initialize and get session handle $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.3; .NET CLR 2.0.50727; ffco7) Gecko/2008092417 Firefox/3.0.3") ; Get connection handle $hConnect = _WinHttpConnect($hOpen, "propaccess.bellcad.org") ; gets page fine ;$sRead = _WinHttpSimpleRequest($hConnect, Default, $sPage) ;MsgBox(64, "test", $sRead) ; gets a "Connection problems" error when filling the form ;$sRead = _WinHttpSimpleFormFill($hConnect, "/clientdb/PropertySearch.aspx?cid=1", "name:Form1", "name:propertySearchOptions:ownerName", "Bob") $sRead = _WinHttpSimpleFormFill($hConnect, "/clientdb/PropertySearch.aspx?cid=1", "index:0", "name:propertySearchOptions:ownerName", "Bob") If @error Then MsgBox(64, "Error", @error) Else MsgBox(64, "", $sRead) EndIf ; Close connection handle _WinHttpCloseHandle($hConnect) ; Close session handle _WinHttpCloseHandle($hOpen)
-
I am trying to log into a website with the WinHttp UDF but for some reason it is giving me a connection error when I use _WinHttpSimpleFormFill. It seems strange to me that _WinHttpConnect does not give me any errors but I get a connection error with _WinHttpSimpleFormFill. I am thinking it might be because of the way the form is using "action=login_auth.php" but I am not sure. Any Ideas on how I can get this working? Here is what I have been trying: #include "WinHttp.au3" $sAddress = "www.website.com" $login_page = "/login.php" $username = "user" $password = "pass" $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.3; .NET CLR 2.0.50727; ffco7) Gecko/2008092417 Firefox/13.0.1") $hConnect = _WinHttpConnect($hOpen, $sAddress) $sRead = _WinHttpSimpleFormFill($hConnect, $login_page, "index:0", "name:username", $username, "password", $password) If @error Then ConsoleWrite("Error = " & @error & @CRLF) EndIf _WinHttpCloseHandle($hOpen) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($sRead) Here is the code of the form I am trying to fill in: <FORM method=post name=formlogin action=login_auth.php><TABLE cellSpacing=0 cellPadding=0 width="100%"> <TBODY> <TR style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"> <TD height=15> <P style="PADDING-BOTTOM: 0px; MARGIN: 10px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px" class=text1>Username:</P></TD> <TD><INPUT tabIndex=1 type=text name=username></TD> <TD height=75 rowSpan=3></TD></TR> <TR style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px"> <TD height=15> <P style="PADDING-BOTTOM: 0px; MARGIN: 10px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px" class=text1>Password: </P></TD> <TD><INPUT tabIndex=2 value="" type=password name=password></TD></TR> <TR> <TD> </TD> <TD> <P style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 10px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px" align=center><INPUT tabIndex=3 value=Login type=submit name=submit></P></TD> <TD> </TD></TR></TBODY></TABLE></FORM>