Что нового

Определить код статуса HTTP

Сообщения
9
Репутация
-1
Как, выполнив Navigate, узнать код статуса:

200 - сервер успешно открыл страницу
404 - запрашиваемая страница не существует
503 - сервер временно недоступен
 
Автор
C
Сообщения
9
Репутация
-1
Что нашел, может кому то пригодится

http://www.autoitscript.com/forum/topic/114077-returning-http-responsestatus-codes-with-autoit/

Код:
Dim $objhttp
Dim $httpstatus
Dim $CheckHTTPStatus
Dim $codetype
Dim $strURL = "http://www.autoitscript.com/"


CheckHttpStatus($strURL)
Func CheckHttpStatus($strActlURL)
    $objhttp = ObjCreate("MSXML2.XMLhttp.3.0") 
    $objhttp.Open("GET", $strActlURL, false) 

    $objhttp.Send 
    $httpstatus = $objhttp.Status
    If $httpstatus = "" Then
        $CheckHTTPStatus = "Error"
    Else
        $codetype = stringleft($httpstatus,1)
        If $codetype = 2 or $codetype = 3 Then
            $CheckHttpStatus = "Success"
        Else
            $CheckHttpStatus = "Error"
        EndIf
    EndIf
    
EndFunc

msgbox(0,"test",$httpstatus)
 
Верх