本文整理自网络,侵删。
idhttp的用法
1)POST
function PostMethod(http: TIDhttp; URL: string; Params: TStringList): string;varRespData: TStringStream;beginRespData := TStringStream.Create('');trytryif http = nil thenExit;Http.Post(URL, Params, RespData);Result := RespData.DataString;http.Request.Referer := URL;exceptResult := '';Exit;end;finallyhttp.Disconnect;FreeAndNil(RespData);end;
2)GET
function GetMethod(http: TIDhttp; URL: string): string;varResp: TStringStream;beginResp := TStringStream.Create('');trytryHttp.Get(URL, Resp);Http.Request.Referer := URL;Result := Resp.DataString;exceptResult := '';Exit;end;finallyFreeAndNil(Resp);end;end;
end;
相关阅读 >>
Delphi windows 编程[12] - 菜单与菜单资源(1-3)
更多相关阅读请进入《Delphi》频道 >>