cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: please I need help

From: Jeffrey Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Wed, 27 Apr 2005 17:29:06 -0500

> 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-28