本文整理自网络,侵删。
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;
相关阅读 >>
Delphi getprocessisadmin()判断exe是否以管理员身份启动
Delphi - 如何执行windows、osx、linux的外部程序?
更多相关阅读请进入《Delphi》频道 >>