<?php $shelves = getShelves(); ?> <div class="row"> <ol class="breadcrumb"> <li><a href="<?php echo URL; ?> ">Home</a></li> <li class="active"><a href="<?php echo URL . '?view=shelves'; ?> ">Shelves</a></li> </ol> </div> <div class="row"> <h3>Shelves</h3> <hr/> </div> <?php for ($i = 0; $i < sizeof($shelves); $i++) { ?> <div class="row panel panel-default" style="padding-top: 2px; padding-left: 25px;"> <h3><span class="label label-default"><?php echo $shelves[$i]["name"]; ?> / <?php
<?php $id = "113720634485746776434"; $shelf = "3"; $maxResults = 10; getShelves($id); getBooks($id, $shelf, $maxResults); function getShelves($id) { $url = "https://www.googleapis.com/books/v1/users/" . $id . "/bookshelves/"; // Set up cURL $ch = curl_init(); // Set the URL curl_setopt($ch, CURLOPT_URL, $url); // don't verify SSL certificate curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Return the contents of the response as a string curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Follow redirects curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // Do the request $json = curl_exec($ch); curl_close($ch); $bookshelves = json_decode($json); foreach ($bookshelves->items as $bookshelf) { //var_dump($bookshelf); if (!empty($bookshelf)) { $results[] = array('id' => $bookshelf->id, 'title' => $bookshelf->title); } } echo "<select>";