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 利用tidencodermime tiddecodermime 组件字符串加密解密

Delphi 去除 tstringlist 重复项

Delphi判断mssql数据库中表格是否存在? 如何批量创建表格?

Delphi一个综合实用的单元

Delphi opendialog1 savedialog1 默认路径

Delphi获取默认浏览器

Delphi char string

Delphi中formatdatetime的用法

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



打赏

取消

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

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

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

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

评论

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