Advertisement
OrAnGeS_SPiRiT

API Allocine JSON

Mar 4th, 2013
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. $sh = curl_init();
  2. curl_setopt($sh, CURLOPT_RETURNTRANSFER,true);
  3. curl_setopt($sh, CURLOPT_URL, "http://api.allocine.fr/rest/v3/movie?partner=YW5kcm9pZC12M3M&code=".$id."&profile=large&format=xml&filter=movie&striptags=synopsis,synopsisshort");
  4. $url = curl_exec($sh);
  5. curl_close($sh);
  6.  
  7. $content = json_decode ( $url );
  8. $movie   = $content->movie;
  9.  
  10. #TiTRE ORiGiNAL
  11. $OriginalTitle = $movie->originalTitle;
  12.  
  13. #TiTRE
  14. $Title = html_entity_decode ( $movie->title );
  15.  
  16. #AFFiCHE
  17. for ( $i = 0 ; count ( $movie->media ) > $i ; $i++ )
  18. {
  19.     if ( $movie->media[$i]->type->code == 31001 )
  20.         $Affiche = $movie->media[$i]->thumbnail->href;
  21. }
  22.  
  23. #SYNOPSiS
  24. $Synopsis = $movie->synopsis;
  25.  
  26. #SYNOPSiS SHORT
  27. $Synopsis_short = $movie->synopsisShort;
  28.  
  29. #ANNEE DE PRODUCTiON
  30. $ProductionYear = $movie->productionYear;
  31.  
  32. #REALiSATEUR
  33. $Realisateur = $movie->castingShort->directors;
  34.  
  35. #GENRE
  36. $Genre = end ( $movie->genre[0] );
  37.  
  38. #DUREE
  39. $Duree = secondsToWords ( $movie->runtime );
  40.  
  41. #ACTEURS
  42. $Acteurs = $movie->castingShort->actors;
  43.  
  44. #ORiGiNE DU FiLM
  45. $Origine = end ( $movie->nationality[0] );
  46.  
  47. #BUDGET
  48. $Budget = $movie->budget;
  49.  
  50. #DATE DE SORTIE
  51. setlocale ( LC_TIME, 'fr_FR.utf8', 'fra' );
  52. $Date_De_Sortie = strftime ( "%d %B %Y", strtotime ( $movie->release->releaseDate ) );
  53.  
  54. #NOTE DE LA PRESSE
  55. $PressRating = round ( $movie->statistics->pressRating, 2 );
  56.  
  57. #NOTE DU PUBLIC
  58. $UserRating = round ( $movie->statistics->userRating, 2 );
  59.  
  60. #AGE MINIMUM
  61. $AgeLegal = $movie->certificate;
  62.  
  63. #TRAILER
  64. $Trailer = $movie->trailer->href;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement