[Lazarus] Plivo API

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Oct 2 21:36:10 CEST 2016


On Sun, 2 Oct 2016 20:45:08 +0200
duilio foschi via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> I am wetting my feet in Plivo API (www.plivo.com).
> 
> "
> Plivo communicates with remote applications built by businesses
> through a series of API calls. These back and forth calls between
> Plivo and other applications are communicated through XML (Extensible
> Markup Language).
> "
> 
> Say that at a given time Plivo calls application X with HTTPS/Post and
> passes it a XML file.
> 
> I need to write a minimal application X in Lazarus that will write the
> XML file to disk
> 
> Could you point me to some sample code possibly using Synapse ?

You don't need Synapse if you only need to download a file. FPC
provides a HTTP client:

function DownloadText(const URL: string): TStrings;
var
  client: TFPHTTPClient;
  doc: TStringList;
begin
  Result:=nil;
  doc:=TStringList.Create;
  client:=TFPHTTPClient.Create(nil);
  try
    client.Get(URL,doc);
    Result:=doc;
    doc:=nil;
  finally
    doc.Free;
    client.Free;
  end;
end;


Mattias


More information about the Lazarus mailing list