本文整理自网络,侵删。
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中webbrowser(或者embeddedwebbrowser)控件打开部分网站报“invalid floating point operation”异常的解决方法
Delphi xe5实现通过tmemorystream将一个unicodestring写入到一个unicode文本文件
Delphi dbnavigator1 删除时弹出确认对话框
更多相关阅读请进入《Delphi》频道 >>