In laravel 7 app I read data with curl and expect returned data be in json format :
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $search_web_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","charset=windows-1251"))
$resp = curl_exec($ch);
\Log::info( '-1 $resp ::' . print_r( $resp, true ) );
But $resp is a string starting with rows :
<?xml version="1.0" encoding="windows-1251"?><ItemValues >...</ItemValues>
So I got error :
Trying to get property 'ItemValues' of non-object {...
on next line :
$ItemValuesRows = json_decode($resp)->ItemValues;
Is my header wrong or which tool to apply to get json rows?
Thanks!