From 5c7f2f17f9c471d306955df457c7cab4e5c6ed3b Mon Sep 17 00:00:00 2001 From: Snap Date: Thu, 16 Apr 2015 14:51:26 -0700 Subject: Google's OpenID Connect method $google_client_id & $google_client_secret must be added to db.inc.php! --- .../examples/batch.php | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 includes/google-api-php-client-master/examples/batch.php (limited to 'includes/google-api-php-client-master/examples/batch.php') diff --git a/includes/google-api-php-client-master/examples/batch.php b/includes/google-api-php-client-master/examples/batch.php new file mode 100644 index 0000000..3c8812f --- /dev/null +++ b/includes/google-api-php-client-master/examples/batch.php @@ -0,0 +1,82 @@ +setApplicationName("Client_Library_Examples"); +$apiKey = ""; // Change to your API key. +// Warn if the API key isn't changed! +if (strpos($apiKey, "<") !== false) { + echo missingApiKeyWarning(); + exit; +} else { + $client->setDeveloperKey($apiKey); + + $service = new Google_Service_Books($client); + + /************************************************ + To actually make the batch call we need to + enable batching on the client - this will apply + globally until we set it to false. This causes + call to the service methods to return the query + rather than immediately executing. + ************************************************/ + $client->setUseBatch(true); + + /************************************************ + We then create a batch, and add each query we + want to execute with keys of our choice - these + keys will be reflected in the returned array. + ************************************************/ + $batch = new Google_Http_Batch($client); + $optParams = array('filter' => 'free-ebooks'); + $req1 = $service->volumes->listVolumes('Henry David Thoreau', $optParams); + $batch->add($req1, "thoreau"); + $req2 = $service->volumes->listVolumes('George Bernard Shaw', $optParams); + $batch->add($req2, "shaw"); + + /************************************************ + Executing the batch will send all requests off + at once. + ************************************************/ + $results = $batch->execute(); + + echo "

Results Of Call 1:

"; + foreach ($results['response-thoreau'] as $item) { + echo $item['volumeInfo']['title'], "
\n"; + } + echo "

Results Of Call 2:

"; + foreach ($results['response-shaw'] as $item) { + echo $item['volumeInfo']['title'], "
\n"; + } +} + +echo pageFooter(__FILE__); -- cgit v1.2.3