Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Created by PhpStorm.
- * User: luc
- * Date: 28-05-2018
- * Time: 08:53
- */
- function getMovieData($titleSearch){
- $apiKey = "&apikey=9997f290";
- $searchString = "http://www.omdbapi.com/?t=";
- $titleSearch = htmlspecialchars($titleSearch);
- $json = file_get_contents($searchString . $titleSearch . $apiKey);
- $obj = json_decode($json);
- echo "<h2>" . $obj->Title . "</h2>";
- echo "<p> Year: " . $obj->Year . "</p>";
- echo "<p> Actors: " . $obj->Actors . "</p>";
- echo "<p> Language: " . $obj->Language . "</p>";
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="css/index.css">
- <link rel="stylesheet" href="css/bootstrap.css">
- <title>RESTful API - Lucas Lund Jensen</title>
- </head>
- <body>
- <div class="container-fluid">
- <div class="row">
- <div class="col-sm-12 text-center" style="background: black;">
- <h1 style="color: white;">Movie Search Website</h1>
- </div>
- <div class="col-sm-12" id="search-bar">
- <form action="search.php" method="GET">
- <div class="form-group row">
- <div class="col-sm-3">
- <input name="titleSearch" class="form-control" type="text" placeholder="Movie title...">
- </div>
- <button class="btn btn-success mb-2">Search</button>
- </div>
- </form>
- </div>
- </div>
- <div class="row">
- <div class="col-sm-6">
- </div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement