Showing posts with label youtube. Show all posts
Showing posts with label youtube. Show all posts

Tuesday, January 3

youtube subscribers count – how to get youtube subscribers count in php

youtube subscribers count – how to get youtube subscribers count in php

php – How to get youtube subscribers count using api

Today i’m operating with youtube api to induce youtube subscribers count in php. Then i found The YouTube API v2.0 is deprecated. And 3.0 has been discharged therefore no have to be compelled to oauth with this api version.
We have to simply require an API KEY to get work. Let’s see a way to get youtube subscribers count in php and wordpress api v3.0. following i’m shring all the steps to induce api key and find subscribers count.
How to get youtube api key
:- following area unit the steps to induce youtube api key
1. move to https://console.developers.google.com/. And log in to your google account.
2. Navigate to APIs & auth and click on on APIs.
3. currently click on YouTube information API link underneath YouTube APIs. and click on on Enable API Button.
4. currently your youtube api has been enabled for your project. currently click on credentials underneath APIs & auth.

5. Click on Add Credentials Then API key in dropdown.

6. currently a brand new popup window can seem, click on Browser key button. Then fill your URL if any else click on Create Key button.

7. a brand new popup window can seem that showing your API key. Copy and use this key to induce subscribers count.

How to get count of youtube subscribers

There area unit curl and file_get_contents() ways in php to urge remote contents. following we tend to area unit business youtube api to urge subscribers count. amendment YOUR_CHANNEL_ID and YOUR_API_KEY with yours.

// Calling api form youtube
$youtube_subscribers = file_get_contents('https://www.googleapis.com/youtube/v3/channels?part=statistics&id=ADD_YOUR_CHANNEL_ID&key=ADD_YOUR_API_KEY');

// Decoding json youtube api response
$youtube_api_response = json_decode($youtube_subscribers, true );

// get count of youtube subscribers.
$subscribers_count = intval($youtube_api_response['items'][0]['statistics']['subscriberCount']);
// print count of youtube subscribers.
echo $subscribers_count;

So currently you’ll be able to simply get your youtube subscribers count using api v3.0.



10 Best Chatting Apps In India

  The modern world is all about Internet. There was a time when people use to pay high telephone bills to stay in touch with their friends a...