Slowly but surely, I am building a site for personal use, where I am looking for the name of the film, and it returns me a metacritical rating. Here is what I got so far:
$web = file_get_contents("http://www.metacritic.com/movie/the-lion-king"); preg_match( '/<span class="score_value" property="v:average">(.*?)<\/span>/s', $web, $match ); foreach ($match as $score) { $sc = $score; echo $sc; }
Result:
8383
If he should return only 83, not 8383.
I pointed the way to where the metacritical rating is located, because I need to capture this information. I'm not sure if this is correct? Maybe very rough work, I do not understand preg_match very well, the documentation on the Internet did not help.
Can anyone help me out?
source share