Jump to content

How to retrieve the poster image from IMDB of a movie given its ID, using PHP?


maaxphp

Recommended Posts

Hi there here is what I am trying to do.

 

 

I have a site

A poster can ask a question about a movie that he/she is unsure of

 

 

Then people can answer

 

If anyone's post is selected as the right answer then I want the poster image to show up in their comment box for the movie.

 

When you answer a question about a movie

You can enter

 

The movie name

IMDB link

IMDB ID

 

So what I want to know is, well I know that there is some javascript onlick function that takes the "select as right answer" clicking action by the Question asker and calls a script which outputs or echos the right answer message. Or this answer is correct message. I want to also summon the IMDB poster image for that commenter if he / she is selected

 

 

Any ideas?

 

 

Omar

 

Link to comment
Share on other sites

It sounds as if you are wanting to implement some AJAX for the ability to select the 'correct' answer. That allows someone to select the right answer without having to refresh the page. That's a great idea. But, first I would suggest building the functionality using a button that is a form and have the form post normally. I.e. have the page refresh and do any back-end processes then redisplay the page with whatever updated information you want. Once you have that working, THEN implement the AJAX so you can do the same thing without a page refresh. Trying to do both at the same time can create difficulty when debugging.

 

However, regarding the ability to extract the movie poster from IMDB is something that I will not, nor anyone else on this forum should, help you with. What you are asking to do is referred to as screen scraping. That is something that violates IMDB's Copyright / Terms Of Use: http://www.imdb.com/help/show_article?conditions

 

Copyright

All content included on this site, such as text, graphics, logos, button icons, images, audio clips, video clips, digital downloads, data compilations, and software, is the property of IMDb or its content suppliers and protected by United States and international copyright laws. The compilation of all content on this site is the exclusive property of IMDb and protected by U.S. and international copyright laws. All software used on this site is the property of IMDb or its software suppliers and protected by United States and international copyright laws.

 

Robots and Screen Scraping: You may not use data mining, robots, screen scraping, or similar data gathering and extraction tools on this site, except with our express written consent as noted below

 

Linking to IMDb.com: You are granted a limited, revocable, and nonexclusive right to create a hyperlink to IMDb.com so long as the link follows our linking guide and does not portray IMDb, its services in a false, misleading, derogatory, or otherwise offensive matter. You may not use any IMDb logo or other proprietary graphic or trademark as part of the link without express written permission except as outlined in
Link to comment
Share on other sites

Yes I was aware of that, but I don't know how to use it to retrieve the image or poster image url based on the movie ID.

 

Could you show me an example of how I would use it.

 

I am using I would use the GET function

Store the url in a php variable like "Movieimg"

then echo it, correct?

 

 

Omer

Link to comment
Share on other sites

You will do a curl request to their API (you'll need an API key) and they return a JSON response with all sorts of data in it.  Including the filepath of the image.

 

At that point you can just json_encode the response, and respond with something like <img src="<?= $theimagepaththeygaveyou?>"/>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.