Skip to content

Instantly share code, notes, and snippets.

@gupul2k
Last active August 29, 2015 14:06
Show Gist options
  • Save gupul2k/2aeb41a8b24808e8e274 to your computer and use it in GitHub Desktop.
Save gupul2k/2aeb41a8b24808e8e274 to your computer and use it in GitHub Desktop.
Read_MovieList_Call_IMDBAPI
Jo Jeeta Wohi Sikandar, 1992
Titanic, 1992
Dhadkan, 2000
Mohabbatein, 2000
Har Dil Jo Pyaar Karega, 2000
Bichhoo, 2000
Pukar, 2000
<html>
<body>
<?php
$myfile =fopen("movie_list.txt", "r") or die("Unable to open file!");
while (!feof($myfile)) {
$line = fgets($myfile);
$pos = strrpos($line, ",");
$movie=substr($line, 0, $pos);
$year=substr($line, $pos+1, strlen($line));
$year=trim($year);
$movie = str_replace(' ', '%', trim($movie));
//echo $movie.$year;
$json=file_get_contents("http://www.omdbapi.com/?t=$movie&y=$year");
$info=json_decode($json);
print_r($info);
echo '<br/>';
}
fclose($myfile);
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment