Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Reading certain data from another website

    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 Code:
    <?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:

    PHP 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

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •