Rotten tomatoes API PHP wrapper
git clone https://github.com/robotomize/RottenTomatoesAPI.git
- Search movies
- Upcoming movies
- Opening movies
- In Theater movies
- Movie info
<?php
$tt = new RottenApi(['apiKey' => '', 'raw' => false]);
print $tt->search('Iron Man', '1');
// return array of objects
<?php
$t2 = new RottenApi(['apiKey' => 'your api key', 'raw' => false]);
print_r($tt->getUpcomingMovies());
<?php
$t3 = new RottenApi();
print_r($t3->getInTheatreMovies());
<?php
$t3 = new RottenApi();
print_r($t3->getOpeningMovies());
<?php
$t3 = new RottenApi();
print_r($t3->getMovieInfo((int)$id));
- Use raw flag to get the results in the original format.
- You can put the key in the / data / credentials for easy debugging or to pass it in the parameters.
<?php
$t2 = new RottenApi(['apiKey' => 'your api key', 'raw' => true]);
$t2->getOpeningMovies();
// return JSON
$t2 = new RottenApi(['apiKey' => 'your api key', 'raw' => false]);
$t2->getOpeningMovies();
// return array of RottenMovieContainer objects
?>
<?php
print_r(RottenFactory::makeRotten()->getInTheatreMovies());
print_r(RottenFactory::makeRotten(['raw' => true])->getInTheatreMovies());
print RottenFactory::makeRotten()->getMovieInfo(771416235)[0]->getTitle();
print RottenFactory::makeRotten()->getMovieInfo(771416235)[0]->getSynopsis();
?>