I am consuming a web service, which I do with cUrl, the size of the content is correct, but the information appears badly formatted in the var_dump
with ASCII characters, this is the code I use to consume the service.
$url = "http://mywebservices.ddns.net:49156/PrdEXObt?ID=fb8e8d73-cf98-461c-94c0-3c5cbfd02b86&Prd=1034-12V&Fmt=XML&Enc=8";
$headers = [
'Accept-Encoding: gzip'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($ch);
curl_close($ch);
var_dump($curl_response);
This is how the information appears
When I consume the web service from a RESTful client, the information appears correctly, example:
What is missing or what error do I have in my code? What is a viable solution?
I needed to decompress the data, solved the problem
$data = gzinflate(substr($curl_response,10,-8));
$data_decode = json_decode($data);