View Full Version : Reading certain data from another website

09-03-2007, 09:34 AM
Hi Guys,

for a type of review site i was wanting to get the average votes for a movies and then display it on my site, the site is imdb, just the number of votes i was trying to get

i have so far:

// IMDB get rating...

$str_text = file_get_contents("http://www.imdb.com/title/tt0373883/");

$pattern = '/(h1|src)=[\'"]/';

preg_match_all($pattern, $str_text, $matches);

echo "<pre>";
echo "</pre>";

in imdb the rating is in this code:

<div class="general rating">
<div class="starbar static"><div class="outer"><div class="inner" style="width: 64px"></div></div></div>
<b>User Rating:</b>
<small>(<a href="ratings">323 votes</a>)</small>
<div class="bottom">

so many spans in the code not sure how to set up the reg ex any help would be appreciated


09-03-2007, 01:53 PM
If I remember correctly this is illegal unless without permission. Plus it's not recommended as you've got to load 2 websites, which make your visitors wait longer to load, and if I remember reading a review and it said so many viewers leave if the website takes too long to load, and it was a very high percentage, so I suggest you make your own vote database.