Código: Seleccionar todo
<html>
<body>
<form action="login" method="post">
<table>
<tr>
<td>User</td>
<td><input name="user" /></td>
</tr>
<tr>
<td>password</td>
<td><input name="password" /></td>
</tr>
</table>
<input type="submit" />
</form>
</body>
</html>
Código: Seleccionar todo
#include "WinHttp.au3"
;; Example 3:
; 1. Open cs.tut.fi forms page (http://www.cs.tut.fi/~jkorpela/forms/testing.html)
; 2. Fill form on that page with these values/conditins:
; - form is to be identifide by its index, It's first form on the page, i.e. index is 0
; - set "Johnny B. Goode" data to textarea. Locate it by its name "Comments".
; - check the checkbox. Locate it by name "box". Checked value is "yes".
; - set "This is hidden, so what?" data to input field identified by name "hidden field".
; - gather data
; Initialize and get session handle
$hOpen = _WinHttpOpen()
; Get connection handle
$hConnect = _WinHttpConnect($hOpen, "localhost")
; Fill form on this page
$sRead = _WinHttpSimpleFormFill($hConnect,Default, "tomas1/login.html", "name:user", "tomas", "name:password", "tomas")
; Close connection handle
_WinHttpCloseHandle($hConnect)
; Close session handle now that's no longer needed
_WinHttpCloseHandle($hOpen)
If $sRead Then
MsgBox(64 + 262144, "Done!", "Will open returned page in your default browser now." & @CRLF & _
"It should show sent data.")
$hFileHTM = FileOpen($sFileHTM, 2)
FileWrite($hFileHTM, $sRead)
FileClose($hFileHTM)
ShellExecuteWait($sFileHTM)
EndIf