How to send a HTTP POST Request in Delphi using WinInet api

前端 未结 3 2253
栀梦
栀梦 2020-11-28 09:34

I am trying to make HTTP Requests from Delphi using the WinInet functions.

So far I have:

function request:string;
var
  hNet,hURL,hRequest: HINTERNE         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 10:00

    Personally I prefer to use the synapse library for all of my TCP/IP work. For example, a simple HTTP post can be coded as:

    uses
      httpsend;
    
    function testpost;
    begin
      stm := tStringstream.create('param=value');
      try
        HttpPostBinary('http://example.com',Stm);
      finally
        stm.free;
      end;
    end;
    

    The library is well written and very easy to modify to suit your specific requirements. The latest subversion release works without any problems for both Delphi 2009 and Delphi 2010. This framework is not component based, but rather is a series of classes and procedures which well in a multi-threaded environment.

提交回复
热议问题