#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 174, 156, -1, -1, -1, BitOR($WS_EX_APPWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
$Group1 = GUICtrlCreateGroup("", 8, 8, 157, 137)
$Input1 = GUICtrlCreateInput("", 16, 40, 137, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
$Input2 = GUICtrlCreateInput("", 16, 72, 137, 21, BitOR($ES_READONLY, $ES_CENTER))
$Button1 = GUICtrlCreateButton("узнать", 16, 104, 139, 25)
$Label1 = GUICtrlCreateLabel("post запрос", 80, 136, 77, 17, $SS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUISetState(@SW_DISABLE)
GUICtrlSetData($Input2, "")
$w1 = _My_Func()
If $w1 <> -1 Then
GUICtrlSetData($Input2, $w1)
Else
GUICtrlSetData($Input2, 'Ошибка')
EndIf
GUISetState(@SW_ENABLE)
EndSwitch
WEnd
Func _My_Func()
$a1 = ($Input1)
$Host = '93.158.134.3'
If Not Ping($Host) Then Return -1
$File = '/xxx/xxx?Info'
$URL = 'http://' & $Host & $File
$PostData = 'aaa=111&bbb=222&' & $a1 & '&method=Info'
Local $oHTTP = ObjCreate('WinHttp.WinHttpRequest.5.1')
$oHTTP.Open('POST', $URL)
$oHTTP.setTimeouts(5000, 5000, 10000, 10000)
$oHTTP.SetRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
Execute('$oHTTP.Send($PostData)')
If (@error) Or ($oHTTP.Status <> 200) Then
Return -1
Else
$oHTTP.WaitForResponse
$Response = $oHTTP.ResponseText
If Not $Response Then Return -1
EndIf
$sMessage = StringRegExpReplace($Response, '(?s).*?<xxx="20">(\d+)</xxx>?.*', '\1')
If Not $sMessage Then Return -1
Return $sMessage
EndFunc ;==>_My_Func