Noobster24 Posted September 1, 2006 Posted September 1, 2006 (edited) Hi, i found this form on a website: <FORM METHOD="POST"> <INPUT TYPE="text" NAME="word" size="20" value=""> <INPUT TYPE="submit" value="GO"> It's awful HTML scripting, I know, because the form has no 'action' attribute. Well i want to post this form, i've got this code: ;some code $Header2 = "Content-Type: application/x-www-form-urlencoded" $Host2 = "website.com" $File2 = "/index.php" $URL2 = "http://" & $Host2 & $File2 $PostData2 = "word=" & $y $Internet2 = _InternetOpen("AutoIT3") $InternetConnection2 = _InternetConnect($Internet2, $Host2) $Request2 = _HttpOpenRequest($InternetConnection2, "POST", $File2) _HttpSendRequest($Request2, $Header2, StringLen($Header2), $PostData2, StringLen($PostData2)) $Response2 = _InternetRead($Request2) QuickOutput($serialfile2, $Response2, 2) _InternetCloseHandle($Internet2) ;some code ; Functions Func QuickOutput($Filename, $Output, $Mode) Local $File = FileOpen($Filename, $Mode) FileWriteLine($File, $Output) FileClose($File) EndFunc Func _InternetOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0) Local $ai_InternetOpen = DllCall('wininet.dll', 'long', 'InternetOpen', 'str', $s_Agent, 'long', $l_AccessType, 'str', $s_ProxyName, 'str', $s_ProxyBypass, 'long', $l_Flags) If @error Or $ai_InternetOpen[0]= 0 Then SetError(-1) Return 0 EndIf Return $ai_InternetOpen[0] EndFunc Func _InternetConnect($l_InternetSession, $s_ServerName) Local $ai_InternetConnect = DllCall('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', 80, 'int', 0, 'int', 0, 'long', 3, 'long', 0, 'long', 0) If @error Or $ai_InternetConnect[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_InternetConnect[0] EndFunc Func _HttpOpenRequest($l_InternetConnection, $s_Verb, $s_File) Local $ai_HttpOpenRequest = DllCall('wininet.dll', 'long', 'HttpOpenRequest', 'long', $l_InternetConnection, 'str', $s_Verb, 'str', $s_File, 'int', 0, 'int', 0, 'int', 0, 'int', 0, 'int', 0) If @error Or $ai_HttpOpenRequest[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_HttpOpenRequest[0] EndFunc Func _HttpSendRequest($l_Request, $s_Headers, $l_HeadersLength, $s_Data, $l_DataLength) Local $ai_HttpSendRequest = DllCall('wininet.dll', 'long', 'HttpSendRequest', 'long', $l_Request, 'str', $s_Headers, 'long', $l_HeadersLength, 'str', $s_Data, 'long', $l_DataLength) If @error Or $ai_HttpSendRequest[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_HttpSendRequest[0] EndFunc Func _InternetRead($l_Request) Local $ai_IRF, $s_Buf = '' Local $v_Struct = DllStructCreate('udword') DllStructSetData($v_Struct, 1, 1) While DllStructGetData($v_Struct, 1) <> 0 $ai_IRF = DllCall('wininet.dll', 'int', 'InternetReadFile', 'long', $l_Request, 'str', '', 'int', 256, 'ptr', DllStructGetPtr($v_Struct)) $s_Buf &= StringLeft($ai_IRF[2], DllStructGetData($v_Struct, 1)) WEnd Return $s_Buf EndFunc Func _InternetCloseHandle($l_InternetSession) Local $ai_InternetCloseHandle = DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'long', $l_InternetSession) If @error Or $ai_InternetCloseHandle[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_InternetCloseHandle[0] EndFunc Well the form isn't posted and i don't want to use the IE.au3 because it opens the process iexplore.exe (i want to make this without iexplore.exe). And this code works for other websites, but these other websites have got an action attribute in HTML.. Anyone knows the solution to post the form? Edited September 1, 2006 by Noobster24 Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
Noobster24 Posted September 1, 2006 Author Posted September 1, 2006 Oops, i looked too fast, it was working, you can delete this topic if you want... Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now