The SitePoint PHP blog continues their series about creating a movie prediction engine with Prediction.io in this second part focusing on implementation. In the first part of the series they set up the server and configuration to make the jump into the code. This second part gets more into the application side and features working code linking the prediction engine with the TheMovieDB API.
He jumps right into the code, showing how to:
- Fetch the data from the TMDB (via Flight and Guzzle)
- Populate the data back into the Prediction.io database
- Picking a random movie from the list (and outputting it to a page)
- Get movies the engine predicts as recommendations
The recommendations are based on ratings on other movies in the database with most of that logic happening behind the scenes instead of in the PHP script. The results are then output to the page along with the other movie data.