Skip to content

Latest commit

 

History

History
43 lines (24 loc) · 1.42 KB

README.md

File metadata and controls

43 lines (24 loc) · 1.42 KB

Table of Contents

  1. Minimal PHP code to retrieve movie trailer links from TMDb API

Minimal PHP code to retrieve movie trailer links from TMDb API

This example code uses the TMDb API but is not endorsed or certified by TMDb.

  1. Subscribe to TMDb with a valid email address

  2. Get the API validation key

  3. Read terms-of-use

  4. Authenticate the api

  5. Use the manual

  6. Add the video ID like this:

    https://www.youtube.com/watch?v={{video_id}}

  7. Check if PHP cURL is available already curl --version if not, just Configure curl on machine

  8. Use the cURL documentation to write a simple script

  9. Get the trailer link via TMDb API

  10. 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>';
    ?>