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?
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?
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.