Kachar ganyalong Posted April 22, 2017 Posted April 22, 2017 Please give me simple way to POST string to URL. Quote
Ron Posted April 24, 2017 Posted April 24, 2017 function PostString(s, url:string):string; var aResponse: TStringStream; aParams:TStringList; mHTTP:TidHTTP; LHandler: TIdSSLIOHandlerSocketOpenSSL; begin mHTTP := TIdHTTP.Create(nil); mHTTP.Request.BasicAuthentication:=false; aParams := TStringList.Create; try LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil); aParams.add('Body='+s); aResponse := TStringStream.Create; try mHTTP.IOHandler:=LHandler; mHTTP.Post(url, aParams, aResponse); finally Result:=aResponse.DataString; LHandler.Free; end; finally aParams.Free; aResponse.Free; mHTTP.Free; end; end; Quote
Ron Posted April 24, 2017 Posted April 24, 2017 You have to modify the params according to need, and remove the IOSSL if not using https. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.