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 字符串查找函数

Delphi 批量文件改名

Delphi 倒计时对话框

Delphi 制作放两个小图片的按钮

Delphi时间格式错误

Delphi mediaplayer1 设置音量

Delphi rest application 与 webbroker application 区别

Delphi if pos 多条件判断用法交流

Delphi recodedatetime、recodedate、recodetime、recodeyear ... 修改时间

Delphi 单元文件结构

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



打赏

取消

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

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

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

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

评论

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