Herb191 Posted July 12, 2012 Share Posted July 12, 2012 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> Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 12, 2012 Moderators Share Posted July 12, 2012 Herb191,I am trying to log into a websitePlease read the Forum Rules - login scripts are prohibited here. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts