获取网页源码socket error #10061,该怎么处理
获取网页源码socket error #10061
------解决方案--------------------
TIdHTTP好像不允许访问本地文件
我也试过这个错误,只能访问网络文件 本地文件会出错
- Delphi(Pascal) code
procedure TForm1.Button1Click(Sender: TObject); var HTML: String; IdHTTP1: TIdHTTP; begin HTML := ''; try IdHTTP1:= TIdHTTP.Create(nil); IDHttp1.HandleRedirects := true; IdHTTP1.request.contenttype:='application/x-www-form-urlencoded'; try //HTML := IdHTTP1.Get('http://xxxxx.com/b.html'); //这个可以正常获取 [color=#FF0000]HTML := IdHTTP1.Get('C:\b.html');[/color] //这个报错 HTML := UTF8Decode(HTML); except end; finally IdHTTP1.Free; end; Application.MessageBox(pchar(HTML),'提示',0) end;
------解决方案--------------------
TIdHTTP好像不允许访问本地文件
我也试过这个错误,只能访问网络文件 本地文件会出错