Informations from imdb with file_get_content and explode problem
Collapse
X
-
Actually I was thinking to try the imdbapi, because I think it will be faster than the explode...
-
Maybe he isn't good with regular expressions or because explode is faster :P
Leave a comment:
-
First Problem:Originally posted by cedry2k View PostWhat is the problem?
It should be alt=" not src="PHP Code:$poster = explode('<img height="317" width="214" src="', $url );
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
Leave a comment:
-
Why dont you use the api Link it will be faster
like this http://imdbapi.org/?q=finding%20nemo you will get a json responseLast edited by kevk3v; 14.05.13, 23:09.
Leave a comment:
-
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:
In the "View page source" I see only this: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;
<img height="170" width="150" />
The imdb page source html for poster is this:
What is the problem?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" />
Tags: None
Leave a comment: