curl-and-php
LibCurl PHP Posting Large XML Problem
Date: Thu, 19 Feb 2004 12:02:34 -0000
Hello, this is my first post here so I hope all goes well.
I am trying to connect to a server using libcurl from php to place an
order. The server I am connecting to gives the following options of how
to pass them the data:
. The Order XML can be posted as an un-encoded string. Using this
method, there will be no parameters. This method is preferred due to the
size limitations on ASP pages.
. The Order XML can also be posted as a form encoded string. The
parameter is called simply XML. Using this method, a size limitation of
approximately 90k exists before encoding takes place. Typically there is
no timing issue for Real Time ordering when using this recommended file
size.
I can manage the secong option using:
$ch = curl_init(); // initialize curl handle
curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // times out after 10s
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, "XML=$data"); // add POST fields
$result = curl_exec($ch); // run the whole process
curl_close($ch);
where $data is my XML and $url is the URL of the server
And this works just fine for small orders. I need to be able to place
large xml orders hence I need to use the first method.
Any ideas how to achieve this?
Many thanks in advance for any help or time given.
Regards
Mark Spittlehouse (PHP MYSQL Developer)
Received on 2004-02-19