Hi friends, if my $error variable is 1 I want to exit the loop For $m = 0 To UBound($a) - 1 How do I do it?
Thank you
Global $oMyError = ObjEvent("AutoIt.Error", "httperror")
Global $error = 0
Local $a[3] = ["http://127.0.1.1", "http://127.0.0.2", "http://127.0.0.3"]
Local $b[2] = ["Post1Test1", "Post1Test2"]
Local $c[2] = ["Post2Test1", "Post2Test2"]
For $m = 0 To UBound($a) - 1
For $X = 0 To UBound($b) - 1
For $i = 0 To UBound($c) - 1
$con = Connect($a[$m], $b[$X] & $c[$i])
ConsoleWrite(" Line Connect : " & @ScriptLineNumber & " -> " & $a[$m] & " " & $b[$X] & " " & $c[$i] & @CRLF)
If $error = 1 Then
ExitLoop
EndIf
Next
Next
Next
Func Connect($Url, $PostData = '')
Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", $Url, False)
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0")
$oHTTP.SetRequestHeader("Accept-Language", "tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3")
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.SetRequestHeader("X-Requested-With", "XMLHttpRequest")
$oHTTP.Send($PostData)
If @error Then
ConsoleWrite("Error connection" & @CRLF)
$error = 1
$oHTTP = 0
Return SetError(1)
EndIf
ConsoleWrite(" Line : " & @ScriptLineNumber & " -> Status : " & $oHTTP.Status & @CRLF)
If $oHTTP.Status = 200 Then
Local $sReceived = $oHTTP.ResponseText
$oHTTP = Null
Return $sReceived
EndIf
$oHTTP = Null
Return -1
EndFunc ;==>Connect
Func httperror()
ConsoleWrite("http error" & @CRLF)
$oMyError.Clear
Return SetError(1)
EndFunc ;==>httperror