Exemple #1
0
<!--creates individual php page for each movie with additional details about the movie-->

<?php 
//establish connection with database table movies
require_once 'connection.php';
require_once 'models/movie-model.php';
//capture id of movie that is clicked on
$id = $_GET['id'];
$conn = getConnection();
$movieModel = new Movies($conn);
$matches = $movieModel->details($id);
//access IMDB API to show Rotten Tomatoes rating information
if (count($matches) == 1) {
    $imdb_id = $matches[0]['imdb_id'];
    $url = "http://www.omdbapi.com/?i=" . $imdb_id . "&tomatoes=true";
    $json = file_get_contents($url);
    $data = json_decode($json);
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta charset="UTF-8">
    <link rel="icon">
    <title>Movie Detail</title>
    
    <!-- bootstrap css -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">