Sign in to follow this  
Followers 0
Herb191

_WinHttpSimpleFormFill is giving me a "Connection problems" error

2 posts in this topic

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>

Share this post


Link to post
Share on other sites



Herb191,

I am trying to log into a website

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

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Similar Content

    • Herb191
      By Herb191
      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)