Best way to post XML via curl?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm going crazy, can't quite get this encoding to work. I've tried all the various combinations, trying to send this block $xml (which is a simple string variable) via post along with 3 other params:

$postArgs = http_build_query(array('method'=>'newPrintRequest', 'login'=>$login, 'password'=>$password, 'orderxml'=>$xml));
$ch = curl_init('http://test.server.com/rest_interface.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postArgs);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
$response = curl_exec($ch);

Is this use of http_build_query the best way to send XML? Any other curl options I should be setting? I tried urlencoding() the $xml, I tried htmlspecialchars(), I tried nothing at all, I tried &amp and &.... is there a "best practice" for how a big block of xml should be posted?

:-(


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux