get youtube channel subscribers via youtube API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpWebDeveloper
    New Member
    • Sep 2014
    • 2

    get youtube channel subscribers via youtube API

    Hello
    I'm trying to use Google Api to get a list of youtube channels the users subscribed to using this file https://github.com/google/google-api...er-example.php and setting $client_id,$cli ent_secret and $redirect_ur. The redirect url is another webpage that stores the code in a variable and it's the same url in the google developer app settings. after running the page I get redirected to the url that looks like this

    Code:
    http://mywebsite.com/google/test.php?code=code here
    $code = $_REQUEST['code'];
    Now I want to use the access token to get a list of youtube channel ids the user had subscribed to using this code

    Code:
    $data =file_get_contents('https://www.googleapis.com/youtube/v3/subscriptions?part=snippet
    &maxResults=50&access_token='.$code.'&mine=true&key=My API Key Here');
    var_export($data)
    But i get "false". How to solve this?
Working...