sjones Posted May 6, 2010 Share Posted May 6, 2010 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 Bruce_GB 1 Link to comment Share on other sites More sharing options...
exodius Posted May 7, 2010 Share Posted May 7, 2010 Welcome to the forums!That looks like the beginnings of a useful udf!You might also want to reference this, I'm not sure if it's very good based on the comments, but I've often seen it referenced around here. Link to comment Share on other sites More sharing options...
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