curl-and-php
XML => Curl => PHP
Date: Mon, 15 Aug 2005 17:40:51 +0200
Hi !
I have a problem.
I want to send xml data with curl and receive that by php.
This where I am :
$xml_data = '<?xml version="1.0" encoding="UTF-8"?>';
$xml_data .= '<XMLCodeBody>';
$xml_data .= '<Messagetxt>';
$xml_data .= '<messageID>Teste</messageID>';
$xml_data .= '</Messagetxt >';
$xml_data .= '</XMLCodeBody>';
$header[] = "Content-type: text/xml\r\n";
$header[] = "Content-length: ".strlen($xml_data)."\r\n";
$header[] = "Connection: Close\r\n";
$header[] = "\r\n";
$url = "http://url";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 4);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
$result = curl_exec($ch);
echo "<p>";
print_r($result);
echo "</p>";
Can you help me ?
Bests regards
Received on 2005-08-15