maaxphp Posted April 23, 2012 Share Posted April 23, 2012 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 Quote Link to comment Share on other sites More sharing options...
Psycho Posted April 23, 2012 Share Posted April 23, 2012 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 Quote Link to comment Share on other sites More sharing options...
maaxphp Posted April 23, 2012 Author Share Posted April 23, 2012 Sorry I meant the moviedb.org Quote Link to comment Share on other sites More sharing options...
kicken Posted April 23, 2012 Share Posted April 23, 2012 Assuming you meant themoviedb.org, they have an API that you can use to access their information. http://help.themoviedb.org/kb/api/movie-images Quote Link to comment Share on other sites More sharing options...
maaxphp Posted April 23, 2012 Author Share Posted April 23, 2012 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 Quote Link to comment Share on other sites More sharing options...
nafetski Posted April 23, 2012 Share Posted April 23, 2012 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?>"/> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.