开发者

Loading of IMDB posters using JQuery not working

开发者 https://www.devze.com 2023-02-07 20:16 出处:网络
I wrote a small utility which helps compare films using an (un-official) API available at imdbapi.com

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&#58;&#47;&#47;ia&#46;media&#45;imdb&#46;com&#47;images&#47;M&#47;MV5BMjA3NDI4ODUwMF5BMl5BanBnXkFtZTcwOTgxOTkyMQ&#64;&#64;&#46;&#95;V1&#46;&#95;SX320&#46;jpg" on this server.<P>
Reference&#32;&#35;24&#46;362e0660&#46;1296452290&#46;2e4450a
</BODY></HTML>
0

精彩评论

暂无评论...
验证码 换一张
取 消