0

Here is a way to do an HTTP post using Indy, in one line, more or less:

Response := FIdHttp.Post(URL, StringStream);

Is there a function out there (function, not library) that allows the equivalent to be done using WinInet?

Preferably, a function that resembles this:

function PostUsingWinInet(const URL, Data :string; SSL :boolean) :string;

I do not want to reinvent the wheel and write my own wrapper function if one already exists.

Thanks!

kes
  • 5,983
  • 8
  • 41
  • 69

2 Answers2

2

See this Stack Overflow question: How to send a HTTP POST Request in Delphi using WinInet api.

Community
  • 1
  • 1
gabr
  • 26,580
  • 9
  • 75
  • 141
  • Thanks, but the function posted there is not self-contained; it relies on other functions the author wrote but did not post. – kes Dec 22 '09 at 15:33
  • No, it is not. It uses only WinInet and Sysutils and maybe Windows (can't bother to check). – gabr Dec 22 '09 at 15:51
1

Take a look at Synapse. Yes it is a library, but not a component one. It exposes classes and simple blocking functions that take the pain out of TCP/IP communication.

For instance, a small program which performs a post (ssl is supported btw):

uses
  httpsend;

var
  url : string;
  urldata : string;
  PostData : tMemoryStream;

begin
    :
  if HttpPostURL(URL, URLData, PostData) then
    Writeln('Sent');
end.
skamradt
  • 15,366
  • 2
  • 36
  • 53