I need to export the result of a GuzzleHttp request to the html table. I'm having trouble turning the output "$ res" into the correct format. What function should I use to transform "$ res" into the correct output? Thanks in advance.
Request:
$client = new \GuzzleHttp\Client();
$res = $client->post($url, ['body' => $xml, 'headers' => ['Content-Type' => 'application/json']])->getBody();
$data = array_map(utf8_encode($res), $res);
echo json_encode($data);
$data output (Exception):
(1/1) ErrorException
array_map() expects parameter 1 to be a valid callback, function '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ser-root:getErrorResponse xmlns:ser-root="http://**********/*****/ws/********">
<StatusCode>0</StatusCode>
<Status_id>SUCCESS</Status_id>
<Results>
<id>2434242</id>
<other_id>63478648</other_id>
<message>id not valid</message>
</Results>
<Results>
<id>5435354</id>
<other_id>2553454563</other_id>
<message>id not valid</message>
</Results>
</ser-root:getErrorResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>' not found or invalid function name