On Thu, Oct 30, 2014 at 6:44 AM, Richard Mace <[email protected]>
wrote:
> Hi All,
> What's the most reliable way of detecting whether a remote website is
> responding?
>
Get the HTTP headers:
uses
fphttpclient;
procedure TForm1.Button1Click(Sender: TObject);
var
VHttp: TFPHTTPClient;
VHeaders: TStrings;
begin
VHttp := TFPHTTPClient.Create(nil);
VHeaders := TStringList.Create;
try
VHttp.RequestHeaders.Add('Connection: Close');
VHttp.Head('http://lazarus.freepascal.org', VHeaders);
if VHeaders.Count > 0 then
ShowMessage('OK')
else
ShowMessage('Fail');
finally
VHeaders.Free;
VHttp.Free;
end;
end;
--
Silvio Clécio
My public projects - github.com/silvioprog
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus