I am writing a win32 service in Delphi (should be able to translate any other code if you don't know delphi), which should get the status of a website. I know how to do this in .NET, but I'm not sure about regular Windows-based programming. So I need to request a website and return a status code of 200, 301 ect. My plan is to analyze the returned data and send an email if one of my sites goes down.
Can someone lend a hand?
EDIT: this is the code I used at the end - using the TIDHttp Indy component.
IdHTTP.Get('http://www.example.com');
if IdHTTP.Connected then begin
ResponseCode := IntToStr(IdHTTP.ResponseCode);
ShowMessage(ResponseCode);
end;
source
share