Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
covercake webservice client PHP
<?php
$API_KEY="api_key_here";
$response = file_get_contents("https://covercake.com/api/v1/feeds?key=$API_KEY");
$j = json_decode($response);
#var_dump($j);
if (strcasecmp($j->status, "OK") != 0)
{
echo "error accessing webservice: " . $j->status_text;
exit;
}
# get feeds, pick a random feed
$feed1 = $j->feeds[4];
#var_dump($feed1);
echo "Feed: " . $feed1->name. "\n";
#get feed info
$response = file_get_contents("https://covercake.com/api/v1/feed_info?key=$API_KEY&id=" . $feed1->id);
$j = json_decode($response);
if (strcasecmp($j->status, "OK") != 0)
{
echo "error accessing webservice: " . $j->status_text;
exit;
}
$featuring = $j->featurings[0];
$book = $featuring->book;
echo "Featured Date: " . $featuring->featured_date . ", book: " . $book->title . "\n";
#get book info
$response = file_get_contents("https://covercake.com/api/v1/book_info?key=$API_KEY&id=" . $book->id);
$j = json_decode($response);
if (strcasecmp($j->status, "OK") != 0)
{
echo "error accessing webservice: " . $j->status_text;
exit;
}
$book = $j->book;
echo "Book isbn : " . $book->isbn10 . "\n";
echo "This book has been featured " . count($j->featurings) . " times\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.