title: How to Get Channel id or url after Google Oauth PHP
body: <p>i am trying to code an application system with youtube login. but i have an issue After i get required authorisation with oauth 2.0 i want to get choosen youtube channel id in a string but i could not do it can somebody please help me. </p>
  
  <pre><code>    $client = new Google_Client();
      $client-&gt;setClientId($client_id);
      $client-&gt;setClientSecret($client_secret);
      $client-&gt;setRedirectUri($redirect_uri);
      $client-&gt;setApplicationName("BYTNETWORK");
      $client-&gt;setScopes(array('https://www.googleapis.com/auth/userinfo.profile',
       'https://www.googleapis.com/auth/yt-analytics.readonly' 
  
        ));
  
  if (isset($_SESSION['access_token']) &amp;&amp; $_SESSION['access_token']) {
    $client-&gt;setAccessToken($_SESSION['access_token']);
  } else {
    $authUrl = $client-&gt;createAuthUrl();
  }
  </code></pre>
  
  <p>so after this i want a string like</p>
  
  <p>$channelid = "xxxxx"; to use it in code below</p>
  
  <pre><code>$data = file_get_contents('http://gdata.youtube.com/feeds/api/users/$channelid?alt=json');
  $data = json_decode($data, true);
  $stats_data = $data['entry']['yt$statistics'];
  $medya = $data['entry']['media$thumbnail'];
  //yt$username kısmından kanal adı parse edilir
  
  /**********************************************************/
  echo "&lt;img src='$medya[url]'&gt;&lt;/img&gt;&lt;br&gt;";
  echo "Subscribers: $stats_data[subscriberCount]&lt;br&gt;";
  echo "Views: $stats_data[totalUploadViews]&lt;br&gt;";
  </code></pre>