Jump to content

sjones

Members
  • Posts

    1
  • Joined

  • Last visited

sjones's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. Hello all, I searched all over the place for example code that can return the HTTP Response/Status codes and couldn't find one anywhere. So.... I decided to write one myself. I hope a few others will find this helpful. 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) Cheers! SJones
×
×
  • Create New...