I'm currently working on a web service project using php5 and have a problem with characters like ö,ä,ü,ß, etc.
The web service works quite simple: The service is a php script located on our server. There are two client libraries (one written in C# and one written in php). The clients send data to the php file on our server with the http post command.
I was able to get the C# client working by using an utf8 encoding to write the data to the stream. The php client (uses cURL) doesn't work though.
php client:
Code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "[URL]");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 300);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, utf8_decode($requestBody));
$responseBody = curl_exec($ch);
service:
Code:
$xml = simplexml_load_string($GLOBALS['HTTP_RAW_POST_DATA']);
I tried echo'ing the post data, everything looks ok. The generated xml document, however, contains the root element, but all child elements are missing.
Any ideas?