Я пытаюсь преобразовать xml в json с помощью запроса CURL, а специальные символы не декодируются должным образом.
Ниже мой код
function APIRequest($zip) {
$URL = "http://www.example.com";
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING => "", // handle compressed
CURLOPT_USERAGENT => "test", // name of client
CURLOPT_AUTOREFERER => true, // set referrer on redirect
);
$ch = curl_init($URL);
curl_setopt_array($ch, $options);
$response = curl_exec($ch);
curl_close($ch);
$xml = simplexml_load_string(utf8_encode($response));
$json = json_encode($xml);
$json_response = json_decode($result);
return $json_response;
}