Jump to content

_WinHttpSimpleFormFill is giving me a "Connection problems" error


Recommended Posts

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>&nbsp;</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>&nbsp;</TD></TR></TBODY></TABLE></FORM>
Link to comment
Share on other sites

  • Moderators

Herb191,

I am trying to log into a website

Please read the Forum Rules - login scripts are prohibited here. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...