total_results == 0) { echo("\n\nno result found for".$moviename); }else { if ($year != 0) { for ($n=0; $n < count($result->results); $n++) { if(strpos($result->results[$n]->release_date, $year) !== false) { copy("http://image.tmdb.org/t/p/w342/".$result->results[$n]->poster_path, $path.str_replace('%20', ' ', $list[$i]).".jpg"); } } }else { echo("http://image.tmdb.org/t/p/original/".$result->results[0]->poster_path."\n\n"); copy("http://image.tmdb.org/t/p/w342/".$result->results[0]->poster_path, $path.str_replace('%20', ' ', $list[$i]).".jpg"); } } } } } ?>