Hello, i have a problem how to make to apear Top Billed Cast all with his photo, json is working but credits and variables it is the same on every character.
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by Travis Bell
on November 9, 2016 at 11:07 AM
Hi @seedfile
If you query the /movie/credits all you need to do is iterate over the
cast
array. Each item contains the person, character name and profile image for the movie.Here's some quick Ruby code showing you the first 4 credits from Fight Club (just as an example):
Reply by seedfile
on November 9, 2016 at 11:36 AM
I have writed this code....
and didn't working...
Reply by Travis Bell
on November 9, 2016 at 11:47 AM
Take a look at the response you're getting back, there is no key called
credits_id
in the root of the JSON object. You need to first access thecast
array, then iterate over each item like I did above .Reply by seedfile
on November 9, 2016 at 12:47 PM
echo $movcredits["cast"][0];
dind't work, have you another php solution like my?
Reply by Travis Bell
on November 9, 2016 at 12:55 PM
I don't know PHP, so I can't be very helpful with that. There's 2 things I suggest at this point:
Cheers.