cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: please I need help

From: Felix Gonzalez <felix.gonzalez_at_gvgest.es>
Date: Fri, 29 Apr 2005 16:55:58 +0200

Thank you very much

-----Mensaje original-----
De: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] En nombre de Jeffrey Pohlmeyer
Enviado el: jueves, 28 de abril de 2005 0:29
Para: curl-library_at_cool.haxx.se
Asunto: Re: please I need help

> curl -v -H "Content-type: text/xml" -d @ASN.xml
> http://b2biqa.alcoadirect.com/SOAP

Hello, Felix -
The Delphi bindings don't have any method to read the
post fields directly from a file, so you need to read
them into a pchar (or ansistring ) yourself. An easy
solution is to read the file into a stringlist object.

I think the code would look something like this:

program felix;
{$APPTYPE CONSOLE}
uses curlobj, classes;
var
  aCurl:tCurl;
  aList:TStringList;
begin
  aCurl:=tCurl.Create(nil);
  aCurl.Verbose:=True;
  aCurl.URL:='http://b2biqa.alcoadirect.com/SOAP';
  aCurl.HttpHeader.Add('Content-type: text/xml');
  aCurl.Post:=True;
  aList:=TStringList.Create;
  aList.LoadFromFile('ASN.xml');
  aCurl.PostFields:=aList.Text;
  if not aCurl.Perform then WriteLn(aCurl.ErrorString);
  aList.Free;
  aCurl.Free;
end.

Regards,
 - Jeff
Received on 2005-04-29