<?php include_once 'RottenTomatoes.php'; $rottenTomatoes = new RottenTomatoes('**Your API Key**', 10, 'us'); echo "<pre>"; try { $result = $rottenTomatoes->getOpeningMovies(); print_r($result); } catch (Exception $e) { print_r($e); } echo "</pre>";
return $this->call($searchUrl); } protected function call($url) { $session = curl_init($url); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); $data = curl_exec($session); curl_close($session); return json_decode($data); } } // Rotten Tomato configurations $rottenTomatoesConfig = array('apikey' => 'yfxz59zsaq3a5h3y85ej7mj6', 'url' => array('search' => 'http://api.rottentomatoes.com/api/public/v1.0/movies.json')); // predefined search keywords $keywords = array($selectedColour = $_POST['Colour']); $rottenTomatoObj = new RottenTomatoes($rottenTomatoesConfig); $searchResults = array(); foreach ($keywords as $keyword) { $searchResults[$keyword] = $rottenTomatoObj->search($keyword); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Rotten Tomatoes</title> <link href="style.css" rel="stylesheet"> </head> <body>