如何从IMDB获得一年的电影或电视节目[关闭]

Is any one tell me how to get a year of specific movie or TV show from IMDB in php?

The OMDB ABI might be of help in this instance. All you would need to do is send an HTTP request (including the a movie's title to the service). Assuming a match, you will get back a JSON-formatted string containing the movie in question's year.

For example:

Request:

http://www.omdbapi.com/?t=Batman&y=&plot=short&r=json

Response:

{"Title":"Batman","Year":"1989","Rated":"PG-13","Released":"23 Jun 1989","Runtime":"126 min","Genre":"Action, Adventure","Director":"Tim Burton","Writer":"Bob Kane (Batman characters), Sam Hamm (story), Sam Hamm (screenplay), Warren Skaaren (screenplay)","Actors":"Michael Keaton, Jack Nicholson, Kim Basinger, Robert Wuhl","Plot":"The Dark Knight of Gotham City begins his war on crime with his first major enemy being the clownishly homicidal Joker.","Language":"English, French","Country":"USA, UK","Awards":"Won 1 Oscar. Another 9 wins & 21 nominations.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTYwNjAyODIyMF5BMl5BanBnXkFtZTYwNDMwMDk2._V1_SX300.jpg","Metascore":"66","imdbRating":"7.6","imdbVotes":"235,641","imdbID":"tt0096895","Type":"movie","Response":"True"}

You could use CURL to get this data:

$service_url = 'http://www.omdbapi.com/';
   $curl = curl_init($service_url);
   $curl_post_data = array(
        "t" => 'batman',
        );
   curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($curl, CURLOPT_POST, true);
   curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);
   $curl_response = curl_exec($curl);
   curl_close($curl);

Alternatively, if you don't mind switching languages, there is also a Python IMDB search package called imdbpy.

In my experience, OMDB is great if you need to make a few quick queries and will always have access to the Internet.

On the other hand, IMDBPY allows you to create a local version of the IMDB data set (in XML or as a SQL DB). This is more suitable for large operations (such as creating a local movie search platform).