I wrote a small utility which helps compare films using an (un-official) API available at imdbapi.com
The api even returns the path of the film poster which I intend to display on my page. The issue that I am running into is that even though the element is created correctly along with the correct path, I get a blank placeholder when I deploy the site online in place of the image.
The images load up while testing on localhost - but don't work online.
Another weird part is that if I have already searched for a film locally and hence have the image cached, that shows up while searching for the same film online - but new posters don't load up.
The source code and everything is online at: http://compovie.com
It's completely in JS - no server side scripting used.
This is really driving me nuts and any help would be appreciated. I have tested this and behaviour repeats in FF 3.6, IE8 and Chrome.
Thanks.
开发者_如何学运维-- Edit 19-Feb-2010 --
The PHP script snippet that I used to get this to work is:
header('Content-Type: image/jpeg');
if(isset($_GET["imgUrl"])) {
$img = file_get_contents($_GET["imgUrl"]);
echo $img;
}
Traced using firebug and looks like imdb restricts access to images based on HTTP_REFERRER. Response given below:
<HTML><HEAD>
<TITLE>Referral Denied</TITLE>
</HEAD><BODY>
<H1>Referral Denied</H1>
You don't have permission to access "http://ia.media-imdb.com/images/M/MV5BMjA3NDI4ODUwMF5BMl5BanBnXkFtZTcwOTgxOTkyMQ@@._V1._SX320.jpg" on this server.<P>
Reference #24.362e0660.1296452290.2e4450a
</BODY></HTML>
精彩评论