https://github.com/pedramardakani/api_php_fetch_trailer
A minimal working example of creating and authenticating a php GET request to an API, and converting the JSON response to a php object.
https://github.com/pedramardakani/api_php_fetch_trailer
api json movie oop php trailer youtube
Last synced: 2 months ago
JSON representation
A minimal working example of creating and authenticating a php GET request to an API, and converting the JSON response to a php object.
- Host: GitHub
- URL: https://github.com/pedramardakani/api_php_fetch_trailer
- Owner: pedramardakani
- License: mit
- Created: 2021-08-18T07:39:06.000Z (almost 5 years ago)
- Default Branch: dev
- Last Pushed: 2021-08-19T09:35:54.000Z (almost 5 years ago)
- Last Synced: 2025-03-20T05:30:32.858Z (over 1 year ago)
- Topics: api, json, movie, oop, php, trailer, youtube
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Table of Contents
1. [Minimal PHP code to retrieve movie trailer links from TMDb API](#orgdcc75b6)
# 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](https://www.themoviedb.org/signup) with a valid email address
2. Get the [API validation](https://developers.themoviedb.org/3/getting-started/introduction) key
3. Read [terms-of-use](https://www.themoviedb.org/documentation/api/terms-of-use)
4. [Authenticate](https://developers.themoviedb.org/3/authentication/how-do-i-generate-a-session-id) the api
5. Use the [manual](https://developers.themoviedb.org/3/movies/get-movie-details)
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](https://www.php.net/manual/en/book.curl.php) on machine
8. Use the `cURL` [documentation](https://www.php.net/manual/en/curl.examples-basic.php) to write a simple script
9. Get the trailer link via TMDb API
10. Embed youtube trailer of the movie like this:
';
?>