php - How to get year of a movie or TV Show from IMDB -
is 1 tell me how year of specific movie or tv show imdb in php?
the omdb abi might of in instance. need send http request (including movie's title service). assuming match, json-formatted string containing movie in question's year.
for example:
request:
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 war on crime first major enemy being clownishly homicidal joker.","language":"english, french","country":"usa, uk","awards":"won 1 oscar. 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 use curl 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 don't mind switching languages, there python imdb search package called imdbpy.
in experience, omdb great if need make few quick queries , have access internet.
on other hand, imdbpy allows create local version of imdb data set (in xml or sql db). more suitable large operations (such creating local movie search platform).
Comments
Post a Comment