Hi

I'm new to Synapse - also new to writing web applications ...

I have access to an API by which I can make request for data by HTTP POST's.

I have used the Google App "Postman" and postings like:-

https://my.xxxxxx.com/api/function1?clientid=2&clienttoken=ThisIsAGUID

... work correctly returning the expected data.

I'll want to incorporate this in my Delphi program and am first writing a simple test bed.

I have been through StackOverflow and the mailing list and found some sample code but I can't make it work.

The actual code is posted below my signature. I do have libeay32.dll and ssleay32.dll in the same folder as my EXE.

The error message that I get is "Winsock error #10091" Network subsystem is unusable

Any help appreciated.

Cheers

Jeff
--
procedure TfrmMain.btnGoClick(Sender: TObject);
var
  sock: TTCPBlockSocket;
  s: string;
begin
  sock := TTCPBlockSocket.Create;
  try
    sock.Connect(EncodeURL('https://my.xxxxxxx.com/api'), '443');
    sock.SSLDoConnect;
    if sock.lasterror <> 0 then // check for success start of SSL
    begin
      sock.ExceptCheck;
Showmessage('Winsock error #' + IntToStr(sock.lasterror) + CRLF + CRLF +
        sock.LastErrorDesc);
      exit;
    end;
    sock.SendString('POST function1?clientid=' + EncodeURLElement('2') +
      '&clienttoken=' + EncodeURLElement
      ('ThisIsAGUID') + CRLF);
    s := sock.recvstring(15000);
    Showmessage(s);
  finally
    sock.Free;
  end;
end;
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to