public function add() { $page = isset($_GET["page"]) ? intval($_GET["page"]) : 1; $order = isset($_GET["order"]) ? $_GET["order"] : "date_added"; $search = isset($_GET["q"]) ? $_GET["q"] : null; return $this->renderView("torrent/add", array("movies" => YTS::getMovies($page, 8, $order, "desc", $search), "page" => $page, "order" => $order, "search" => $search)); }
<?php include 'inc/YTS.php'; $yts = new YTS(); $movies = $yts->listMovies('All', 3); // All quality, limit 3 //Did we find movies? if ($movies) { foreach ($movies as $movie) { echo '<b>' . $movie->title . '</b><br/>'; //Movie title from api $torrent = $movie->torrents[0]; //First torrent echo '<a href="' . $torrent->url . '">' . $torrent->url . '</a> (' . $torrent->size . ')<br/>'; // Torrent url and size if ($parentalGuides = $yts->movieParentalGuides($movie->id)) { //Did we find parental guides? echo 'This movie has:'; foreach ($parentalGuides as $parentalGuide) { echo ' ' . $parentalGuide->type; //Show parental guides } echo '<br/>'; } echo '<br/>'; } } /** * Example results: * * Dinosaur Island