How to read youtube data api v3 response in php How to read youtube data api v3 response in php json json

How to read youtube data api v3 response in php


You can reach it as in an array:

print_r ($yt_profiles['modelData']);


Your request:

$yt_profiles = $youtube->channels->listChannels('brandingSettings', array('mine' => 'true',));

To acces to values Channel title for example:

$titleChannel = $yt_profiles["items"][0]["brandingSettings"]["channel"]["title"];

To acces to values bannerImageUrl for example:

$banner = $yt_profiles["items"][0]["brandingSettings"]["image"]["bannerImageUrl"];


Does this help you?

    $yt_profiles = $youtube->channels->listChannels('id, brandingSettings', array('mine' => 'true',));    foreach ($yt_profiles['modelData']['items'] as $searchResult) {      switch ($searchResult['kind']) {        case 'youtube#channel':          $channels[]= array('id'=> $searchResult['id'],                             'brandingSettings'=> $searchResult['brandingSettings']);          break;      }    }