This example code uses the TMDb API but is not endorsed or certified by TMDb.
-
Subscribe to TMDb with a valid email address
-
Get the API validation key
-
Read terms-of-use
-
Authenticate the api
-
Use the manual
-
Add the video ID like this:
https://www.youtube.com/watch?v={{video_id}}
-
Check if PHP
cURL
is available alreadycurl --version
if not, just Configure curl on machine -
Use the
cURL
documentation to write a simple script -
Get the trailer link via TMDb API
-
Embed youtube trailer of the movie like this:
<?php // A simple example key: $trailer_key = 'G4_ULVw5L04'; $trailer_url = 'https://www.youtube.com/embed/' . $trailer_key; // Minimal iframe $embed_this = '<iframe src="' . $trailer_url . '"></iframe>'; ?>