There is such a code, $ json is an array of data, the server's response can be different, so you need to dynamically form what to address.
I read this section http://php.net/manual/ru/language.variables.variable.php and I can not refer to the zero element.
$num_hist = count($json->list[0]->Item->HistoryItemList); How generally to save the given line list[0]->Item->HistoryItemList then to receive the data having generated $json->... ?
That is, it is required like such an array from which then to assemble a string to get data from $ json
$arr = [ 'list[0]', 'Item', 'HistoryItemList', ];