Dieuz Posted June 28, 2010 Posted June 28, 2010 (edited) Is there any function out there to retrieve the HTTP Status code of a webpage? I want to check every ten minutes or so if my website is still online. I thought of using Ping but this function doesnt seems to return lot of infos... Thanks! Edited June 28, 2010 by Dieuz
Dieuz Posted June 28, 2010 Author Posted June 28, 2010 Would this work? $URL = "http://www.google.com" If NOT(_INetGetSource($URL) = "") Then MsgBox(0,"","Your website is Online") Else MsgBox(0,"","Your website is Offline") EndIf
Fire Posted June 28, 2010 Posted June 28, 2010 Also you can try this udf too http://www.autoitscript.com/forum/index.php?showtopic=84133 #include "WinHTTP.au3" $nOffset = 1 $input=InputBox("Enter Site URL","ENTER SITE URL","","") $hOpen = _WinHttpOpen() $hConnect = _WinHttpConnect($hOpen, $input) $hRequest = _WinHttpOpenRequest($hConnect, "GET", "/") _WinHttpSendRequest($hRequest) _WinHttpReceiveResponse($hRequest) If _WinHttpQueryDataAvailable($hRequest) Then $header = _WinHttpQueryHeaders($hRequest) _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) FileWrite(@TempDir&"\headerinfo.ini",$header) EndIf $str=FileRead(@TempDir&"\headerinfo.ini") MsgBox(64,"",FileReadLine(@TempDir&"\headerinfo.ini",1)) FileDelete(@TempDir&"\headerinfo.ini") [size="5"] [/size]
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