How To Display YouTube Video Views Count In PHP

How To Display YouTube Video Views Count In PHP

If you’re running a website where you embed/link YouTube videos then you might wanna display YouTube video views count on your website. Here’s how to do it. This snippet was used by me when I was working on a client’s website earlier this hour. This is probably the easiest way to display views count.

Just drop the following snippet:

Just drop the video ID in the first line in the above snippet.

If you wanna get video views by YouTube video URL, then you can use this snippet which will first get the video ID from the long URL to display views count:

Hope this snippet will help you out :)