delphi idhttp的用法


本文整理自网络,侵删。

 
idhttp的用法

1)POST

function PostMethod(http: TIDhttp; URL: string; Params: TStringList): string;
var
RespData: TStringStream;
begin
RespData := TStringStream.Create('');
try
try
if http = nil then
Exit;
Http.Post(URL, Params, RespData);
Result := RespData.DataString;
http.Request.Referer := URL;
except
Result := '';
Exit;
end;
finally
http.Disconnect;
FreeAndNil(RespData);
end;

2)GET

function GetMethod(http: TIDhttp; URL: string): string;
var
Resp: TStringStream;
begin
Resp := TStringStream.Create('');
try
try
Http.Get(URL, Resp);
Http.Request.Referer := URL;
Result := Resp.DataString;
except
Result := '';
Exit;
end;
finally
FreeAndNil(Resp);
end;
end;


end;

相关阅读 >>

Delphi 分割字符串 extractstrings

Delphi 一个高效的正整数排序函数

Delphi sqlite实现加密

Delphi的串口通讯,数据接收实时性太差

Delphi windows 编程[12] - 菜单与菜单资源(1-3)

Delphi windows服务控制单元

Delphi idhttp控件的防止异常的处理

Delphi中accesss实现树形结构查询系统

Delphi读取android短信信息

Delphi idwhois1 简单的用法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...