...

View Full Version : Reading certain data from another website



graham23s
09-03-2007, 08: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:


<?php
//=====================================================================================//
// 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>";
var_dump($matches);
echo "</pre>";
?>

in imdb the rating is in this code:


</div>
<div class="general rating">
<div class="starbar static"><div class="outer"><div class="inner" style="width: 64px"></div></div></div>
<b>User Rating:</b>
<b>3.2/10</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

Graham

Iszak
09-03-2007, 12: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum