Hello. Ive got this script which scrapes IMDB for their top 250 movies list but its not parsing and Im not sure why. Could you help me out please....
<?php
function get_inner_string($a,$b,$c)
{
$y = explode($b,$a);
$x = explode($c,$y[1]);
return $x[0];
}
//Get Page
$file = 'http://www.imdb.com/chart/top';
//Open Page
$open_file = file_get_contents($file);
//Find the list
$find_ad = get_inner_string($open_file, '<i>For this top 250, only votes from regular voters are considered.</i>', 'The formula for calculating the Top Rated 250 Titles gives a <b>true Bayesian estimate</b>:');
//Add http://www.imdb.com/ to the URL's
$new_page = str_replace('a href="/title/', 'a href="http://www.imdb.com/title/', $find_ad);
//Find movie name
$find_movie = get_inner_string($new_page, '/">', '</a>');
//Define search URL
$search_url = '<a href="search.php?do=process&sortby=lastpost&titleonly=true&query=' . $find_movie . '"> Search </a>';
//Put together )</font> and $search_url
$join_bits = ') - </font>' . $search_url;
//Replace )</font> with search link
$final_page = str_replace(')</font>', $join_bits, $find_ad)
echo $final_page;
?>