Вот JSON текст-
{
"kind": "youtube#commentThreadListResponse",
"etag": "\"SJZWTG6xR0eGuCOh2bX6w3s4F94/CTTPi63Nf0uw0VTa1vFAqqL88k8\"",
"pageInfo": {
"totalResults": 2,
"resultsPerPage": 20
},
"items": [
{
"kind": "youtube#commentThread",
"etag": "\"SJZWTG6xR0eGuCOh2bX6w3s4F94/adPDtbu8m9cY9xkHacyKvWARfR8\"",
"id": "Ugy2poa2UDXYm-kUKWh4AaABAg",
"snippet": {
"videoId": "kVUIh5cp3mY",
"topLevelComment": {
"kind": "youtube#comment",
"etag": "\"SJZWTG6xR0eGuCOh2bX6w3s4F94/xgKA1zcXGWvsBnMxKuksawMPqy8\"",
"id": "Ugy2poa2UDXYm-kUKWh4AaABAg",
"snippet": {
"authorDisplayName": "Thelma S. Brittain",
"authorProfileImageUrl": "https://yt3.ggpht.com/a/",
"authorChannelUrl": "http://www.youtube.com/channel/",
"authorChannelId": {
"value": "UC1W2wC96X4SjdAewhPi-mpg"
},
"videoId": "kVUIh5cp3mY",
"textDisplay": "Hello thanks for the video.",
"textOriginal": "Hello thanks for the video.",
"canRate": true,
"viewerRating": "none",
"likeCount": 0,
"publishedAt": "2019-06-28T17:48:18.000Z",
"updatedAt": "2019-06-28T17:48:18.000Z"
}
},
"canReply": true,
"totalReplyCount": 0,
"isPublic": true
}
}
]
}
Я получил этот JSON текст с помощью API YouTube. Я пытаюсь повторить «authorDisplayName» и «textOriginal», но это не работает. Я пытался во многих отношениях. Я не могу понять свою ошибку. Я пробовал это далеко,
$url = file_get_contents("https://www.something.com");
$arr = json_decode($url, true);
echo $arr['items']->['snippet'][0]->['topLevelComment']->['snippet']->['authorDisplayName'];
echo $arr['items']->['snippet']->['topLevelComment']->['snippet']->['textOriginal'];
Может кто-нибудь помочь мне решить эту проблему? Спасибо.