Beispiel #1
0
<?php

//tmdb api key
define('TMDB_URI', 'https://api.themoviedb.org/3/');
define('API_KEY', '166547236c6c7c2a230787e413461366');
//gets the function call from func and the rest of the query string are dependent on
//the api request
if (isset($_POST['func'])) {
    $func = $_POST['func'];
    //all the functions
    switch ($func) {
        case 'SearchMovie':
            searchMovie();
            break;
        case 'GetMovie':
            $id = $_POST['id'];
            getMovie($id);
            break;
    }
}
//when adding a movie it searches and returns the list
function searchMovie()
{
    //multiple words
    $query = urlencode($_POST['query']);
    //the json link
    $jsonMovieList = TMDB_URI . 'search/movie?query=' . $query . '&api_key=' . API_KEY;
    $json = file_get_contents($jsonMovieList);
    //the movie list object
    $movieList = json_decode($json, true, 512, JSON_BIGINT_AS_STRING);
    //bring the json object back to page
Beispiel #2
0
if (empty($localmovie_return)) {
    include_once 'class.CompareNew.php';
    //array based string comparison
    $time_start = microtime(true);
    $myDataArray = array();
    $langArray = array('ENGLISH', 'MALAYALAM', 'TAMIL', 'HINDI', 'TELUGU', 'ARABIC');
    $placeArray = array('DUBAI', 'SHARJAH', 'AJMAN', 'ABU DHABI', 'AL AIN', 'FUJAIRAH', 'RAS AL KHAIMAH', 'UMM AL QU WIN');
    $show_req = preg_replace("~\\b((movie|show|time|timing|showtime|showtiming)s?)\\b~", '', $spell_checked);
    $show_req = trim(preg_replace("~[\\s]+~", " ", $show_req));
    if (preg_match("~(.*) (in|at|near) (.+)~", $show_req, $matches)) {
        $movie_array = searchMovie($matches[1], $matches[3]);
    } else {
        if (in_array(strtoupper($show_req), $placeArray)) {
            $movie_array = searchMovie('', $show_req);
        } else {
            $movie_array = searchMovie($show_req, '');
        }
    }
    if (!empty($movie_array)) {
        if (is_array($movie_array['movie'])) {
            $localmovie_return = "Place: " . $movie_array['place'][0] . "\n";
            foreach ($movie_array['movie'] as $key => $value) {
                $localmovie_return .= "Movie: " . $value . " [" . $movie_array['lang'][$key] . "]\n";
                $localmovie_return .= $movie_array['info'][$key] . "\n";
            }
        } else {
            $localmovie_return = "Movie: " . $movie_array['movie'] . "[" . $movie_array['lang'] . "]\n";
            foreach ($movie_array['place'] as $key => $value) {
                $localmovie_return .= "Place: " . $value . "\n";
                $localmovie_return .= $movie_array['info'][$key] . "\n";
            }
Beispiel #3
0
<!-- ********Author: Pooja, TingTing, Allan, Shubham @ Date: 2015 Fall ************-->
<?php 
$pageTitle = 'lesuirely | Search';
include 'header.php';
?>

<div class="vuser" id="searchbox">
  <?php 
$itempage = 1;
$search = '';
$max = 0;
$jsonData = searchMovie($search, $itempage, $max);
$json = json_decode($jsonData);
?>
  <h3> Movies from your key word: <?php 
echo $search;
?>
</h3>
  <table>
    <tr class="movie">
      <?php 
$count = 0;
for ($i = 0; $i < count($json); $i++) {
    $data = $json[$i];
    if ($count < 4) {
        $count++;
        ?>
          <td class="item center"><img class="book" src = "<?php 
        echo $data->imgurl;
        ?>
"><h5><a name="<?php