We can use a PHP function to get the YouTube video duration. Before that, you should have Google API Key 1.Create Google API and get API key from Goog’s official website https://console.developers.google.com One important Note. At the time of creating API, leave the below option blank ” Accept requests from these HTTP referrers (web sites) (Optional)”….