码迷,mamicode.com
首页 > Web开发 > 详细

idhttp的用法

时间:2016-12-20 13:54:27      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:get   and   nec   var   ram   except   erer   create   params   

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;

idhttp的用法

标签:get   and   nec   var   ram   except   erer   create   params   

原文地址:http://www.cnblogs.com/hnxxcxg/p/6202226.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!