How to get YouTube Video Info with PHP

How to get YouTube Video Info with PHP

In this tutorial I will explain how to get YouTube video info with PHP. In my last tutorial I explained how to retrieve YouTube video details using JavaScript. Replying to that article the first commenter- Ryan requested me a PHP version of the same tool.

If you are looking for something deep with server side facilities, you need to use a server side language like PHP. Specially when it comes to SEO and other content stuffs, PHP is important and JS is pretty useless. As Ryan requested it immediately and without using JSON, I came up with this code. But it is based on this wonderful resources on IBM developers: Use the YouTube API with PHP. If anyone needs to learn A-Z about YouTube and PHP I recommend to read that and YouTube API v2.0 (I prefer v2 over v3).

Use PHP to retrieve single video details from YouTube API

This code is pretty well commented. So I’m not going to explain every bit of it. To see the demo go to YouTube video generating tool here:

This is the exact same PHP version of our JS version using the same DIV classes and IDs. You can use the style from it if you need.

Comments
  1. Ryan

    This is exactly what I wanted. Thanks bro.

ADD YOUR COMMENT

Please note: Only English and related comments will be approved.
Type BLACK color text and click Submit Comment.