When I run an API request, I get the following data back.
How do I use PHP to grab the subscriberCount
data from this?
{
"kind": "youtube#channelListResponse",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"statistics": {
"subscriberCount": "80021",
}
}
]
}
I have tried this, but no success:
<?php
$json = '{
"kind": "youtube#channelListResponse",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"statistics": {
"subscriberCount": "80021",
}
}
]
}';
$yummy = json_decode($json);
echo $yummy->subscriberCount;
?>