我正在使用php中的curl获取数据
$curl = curl_init();
$url = 'http://tas-1cksq.kdc.uz:81/magazin/hs/sc5/shop/111';
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Accept: application/json'
]);
// Authentication [Optional]
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_URL, $url);
$result = curl_exec($curl);
return $result;
但是当我使用json_decode()时,$ result
$result = curl_exec($curl);
$mass = json_decode($result);
return $mass['message']['id'];
它没有返回任何值。 这是什么问题?