Best way to post XML via curl?

From: Date: Thu, 12 Feb 2009 00:42:43 +0000
Subject: Best way to post XML via curl?
Groups: php.general 
Request: Send a blank email to php-general+get-288133@lists.php.net to get a copy of this message
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? :-(

« previous php.general (#288133) next »