- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi IdHttp 获取链接连通状态
var
http : TIdHttp;
url : string;
code : integer;
begin
url := 'http://www.delphitop.com/';
http := TIdHTTP.Create(nil);
try
try
http.Get(url, nil);
code := http.ResponseCode;
except
on E: EIdHTTPProtocolException do
code := http.ResponseCode; // or: code := E.ErrorCode;
end;
ShowMessage(IntToStr(code));
finally
http.Free();
end;