Informations from imdb with file_get_content and explode problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Informations from imdb with file_get_content and explode problem

    Hi, I'm trying to make an plugin that grab the movie info from imdb and displays them on a page.
    The problem is that I can't get the poster.
    This is my code:

    PHP Code:
    $url file_get_contents("http://www.imdb.com/title/tt1980209/");
    $poster explode('<img height="317" width="214" src="'$url );
    $poster explode('" itemprop="image" />'$poster[1]);

    $picture '<img height="170" width="150" src="'.$poster[0].'" />';
    echo 
    $picture
    In the "View page source" I see only this:
    <img height="170" width="150" />

    The imdb page source html for poster is this:
    Code:
    <img height="317"
    width="214"
    alt="Pain & Gain (2013) Poster"
    title="Pain & Gain (2013) Poster"
    src="http://ia.media-imdb.com/images/M/MV5BMTU0NDE5NTU0OV5BMl5BanBnXkFtZTcwMzI1OTMzOQ@@._V1_SY317_CR0,0,214,317_.jpg"
    itemprop="image" />
    What is the problem?

    #2
    Why dont you use the api Link it will be faster
    like this http://imdbapi.org/?q=finding%20nemo you will get a json response
    Last edited by kevk3v; 14.05.13, 23:09.
    Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

    Comment


      #3
      Originally posted by cedry2k View Post
      What is the problem?
      First Problem:
      PHP Code:
      $poster explode('<img height="317" width="214" src="'$url ); 
      It should be alt=" not src="

      Second problem:
      You need to strip all newline symbols \n \r and white-space etc as other wise you will not get a match for your exploding

      Comment


        #4
        Why dont you use preg_split instead of explode ?

        Comment


          #5
          Maybe he isn't good with regular expressions or because explode is faster :P
          Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

          Comment


            #6
            Or maybe he's trying to make something different..
            It's n0t that i am afraid to die. Its just that if i die, wh0 wilL loVe her as muCh as i Do?

            Comment


              #7
              Actually I was thinking to try the imdbapi, because I think it will be faster than the explode...

              Comment

              Working...
              X