`

delphi的connection closed Gracefully错误

 
阅读更多

将这个放到调用页面上....一个处理地址函数..

function GetWebPage(URL: string):string;

var

IDHTTP: TIDHttp;

ss: String;

begin

IDHTTP:= TIDHTTP.Create(nil);

try

try

idhttp.Disconnect;

idhttp.HandleRedirects:= true; //必须支持重定向否则可能出错

idhttp.ReadTimeout:= 30000; //超过这个时间则不再访问

ss:=idhttp.Get(url);

//ss:=UTF8ToAnsi( ss); //UTF8编码转换

if IDHTTP.ResponseCode=200 then

Result := ss;

except

//ss:='';

end;

finally

IDHTTP.Free;

end;

end;

===========================================================

注意:

get百度时,需要修改http头:
User-Agent: Mozilla/3.0 (compatible; Indy Library)
因为百度屏蔽了 ‘Indy Library’ 这个客户端标识的。

分享到:
评论

相关推荐

    TightVNC-2.8.11.0

    TightVNC ( vnc viewer )是一个基于免费的远程控制软件包,能让你轻松控制远程的计算机,它可以通过在另一端电脑上安装配套使用的tightvnc viewer来进行与服务器的远程连接,就像坐在自己家的计算机前面一般,让你...

    go-gracefully:Golang 的优雅关闭实用程序

    优雅地去优雅的关机实用程序,在第二个信号时硬退出。 查看。安装 $ go get github.com/tj/go-gracefully... Start ()gracefully . Timeout = 10 * time . Secondgracefully . Shutdown ()w . Stop ()执照麻省理工学院

    HttpConnectionTool工具类

    通过HttpConnection请求跨域接口 public String invokeServiceMethod(String url,Map,String> params,Map, String> header) throws Exception{ HttpClient ... // release connection gracefully } }

    gracefully-hooked:优雅地勾起店面

    优雅地钩构建设置# install dependencies$ yarn install# serve with hot reload at localhost:3000$ yarn dev# build for production and launch server$ yarn build$ yarn start# generate static project$ yarn ...

    geode-aes.rar_operation

    A very large counter that is used to gracefully bail out of an operation in case of trouble.

    开源项目-assafmo-joincap.zip

    开源项目-assafmo-joincap.zip,Feedback needed: joincap - Merge multiple pcap files together, gracefully.

    开源项目-jpillora-overseer.zip

    开源项目-jpillora-overseer.zip,overseer: Monitorable, gracefully restarting, self-upgrading binaries in Go

    CoreOS in action

    CoreOS in Action is a clear tutorial for ...Handling scaling and failures gracefully Container-driven application designs Cloud, on-premises, and hybrid deployment Smart logging and backup practices

    node-execr:跨平台执行

    任何错误,改进或功能,请留下票证或合并请求! 执照 麻省理工学院(请参阅许可) 用法 $ execr --help Usage: execr --prefix=ARG env syntax prefix --suffix=ARG env syntax suffix -v, --verbose print exec...

    开源项目-olahol-go-imageupload.zip

    开源项目-olahol-go-imageupload.zip,go-imageupload: Gracefully handle image uploading and thumbnail creation.

    Parsing JSON in Swift

    Parsing JSON in Swift will teach you to harness the power of Swift and give you confidence that your app can gracefully handle any JSON that comes its way. You'll learn: - How to use ...

    细谈HTML 5新增的元素

    这就叫degrade gracefully(优雅降级)。让我们来看看HTML 5增加的一些新元素。 HTML 5结构元素 这真是大快人心。目前,我们定义结构只能通过一个“万能”的div, 试图通过设置它的特性id的值如header, footer, ...

    开源项目-olahol-go-imageupload#go-imageupload.zip

    开源项目-olahol-go-imageupload#go-imageupload.zip,go-imageupload: Gracefully handle image uploading and thumbnail creation.

Global site tag (gtag.js) - Google Analytics