delphi achieve post request, provided that the head of the first component reference IDHttp
where fhttpRequest: TIdHTTP; PostData : TStringStream; tmpStr : String; begin fhttpRequest := TIdHTTP.Create(nil); fhttpRequest.HandleRedirects: = True; // allow steering head fhttpRequest.ReadTimeout: = 5000; // Set request timeout fhttpRequest.Request.ContentType: = 'application / x-www-form-urlencoded'; // set the content type to json PostData := TStringStream.Create(''); //PostData.Position: = 0; // set the position of the stream 0 PostData.WriteString('encode=773130f7236b15405c9497c19bf24a038ba04197f017bfb0dd66d455bcb75e9e580'); PostData.WriteString('302a5d177cae445ae6c97be24a74344c2cade3dee0015cda9e3ef05a71a9b32409f7d026e633a8125d8d62298aa1a5d35c50e40dc316a07b355d4f70b712b73f37befe911824a78ec556556951d2bf76ec4944e73cbc3b2b88ada31a85b09'); tmpStr: = fhttpRequest.Post ( 'http://10.32.8.34:8081/phis/EncodeServlet',PostData); // tmpStr submitted after the data is returned fhttpRequest.free; PostData.Free; Result:=tmpStr; end;