Advertisement
Guest User

Untitled

a guest
May 28th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.56 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: luc
  5.  * Date: 28-05-2018
  6.  * Time: 08:53
  7.  */
  8.  
  9. function getMovieData($titleSearch){
  10.     $apiKey = "&apikey=9997f290";
  11.     $searchString = "http://www.omdbapi.com/?t=";
  12.  
  13.     $titleSearch = htmlspecialchars($titleSearch);
  14.  
  15.     $json = file_get_contents($searchString . $titleSearch . $apiKey);
  16.  
  17.     $obj = json_decode($json);
  18.  
  19.     echo "<h2>" . $obj->Title . "</h2>";
  20.     echo "<p> Year: " . $obj->Year . "</p>";
  21.     echo "<p> Actors: " . $obj->Actors . "</p>";
  22.     echo "<p> Language: " . $obj->Language . "</p>";
  23.  
  24. }
  25.  
  26.  
  27. ?>
  28.  
  29. <!DOCTYPE html>
  30. <html>
  31. <head>
  32.     <link rel="stylesheet" href="css/index.css">
  33.     <link rel="stylesheet" href="css/bootstrap.css">
  34.     <title>RESTful API - Lucas Lund Jensen</title>
  35. </head>
  36. <body>
  37. <div class="container-fluid">
  38.     <div class="row">
  39.         <div class="col-sm-12 text-center" style="background: black;">
  40.             <h1 style="color: white;">Movie Search Website</h1>
  41.         </div>
  42.         <div class="col-sm-12" id="search-bar">
  43.             <form action="search.php" method="GET">
  44.                 <div class="form-group row">
  45.                     <div class="col-sm-3">
  46.                         <input name="titleSearch" class="form-control" type="text" placeholder="Movie title...">
  47.                     </div>
  48.                     <button class="btn btn-success mb-2">Search</button>
  49.                 </div>
  50.             </form>
  51.         </div>
  52.     </div>
  53.  
  54.     <div class="row">
  55.         <div class="col-sm-6">
  56.  
  57.         </div>
  58.     </div>
  59. </div>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement