Copying imdb information

0

Good morning everyone, well I'm creating an application in PHP and I need to get information from IMDb movies, what is the best way to capture IMDb information? Curl or is there any api that will help me in this?

    
asked by anonymous 19.09.2017 / 06:14

1 answer

1

You need to decode the answer and assign it to variables (all in PHP).

<?php
$id = $_POST["id"];
$url = file_get_contents("http://www.omdbapi.com/?i=$id");
$json = json_decode($url, true); //This will convert it to an array
$movie_title = $json['Title'];
$movie_year = $json['Year'];
//and so on...

and then when you need to echo them:

echo $movie_title;

or

echo "The movie '$movie_title' was made in $movie_year.";

You can use this too: PHP-IMDB-API is in json.

    
19.09.2017 / 06:36