-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
38 lines (32 loc) · 1.07 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
include 'vendor/autoload.php';
$providers = array(
array(
'provider' => new \Sprain\BookFinder\Providers\GoogleProvider('YOUR_GOOGLE_API_KEY'),
'name' => 'Google', // optional
'order' => 2 // optional, but recommended
),
array(
'provider' => new \Sprain\BookFinder\Providers\AmazonProvider('YOUR_AMAZON_ACCESS_KEY', 'YOUR_AMAZON_SECRET', 'YOUR_AMAZON_ASSOCIATE_TAG'),
'name' => 'Amazon', // optional
'order' => 1 // optional, but recommended
),
);
$bookFinder = new \Sprain\BookFinder\BookFinder($providers);
// Look for "The Art of the Start"
$response = $bookFinder->searchByIsbn('9781591840565');
var_dump(array(
$response->getResult(),
$response->getProviderName(),
get_class($response->getProvider())
));
// Look for "Darm mit Charme"
$response = $bookFinder->searchByIsbn('3843707111');
var_dump(array(
$response->getResult(),
$response->getProviderName(),
get_class($response->getProvider())
));
// Look for a failing result
$response = $bookFinder->searchByIsbn('foo');
var_dump($response);