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/simple-query.php | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 includes/google-api-php-client-master/examples/simple-query.php (limited to 'includes/google-api-php-client-master/examples/simple-query.php') diff --git a/includes/google-api-php-client-master/examples/simple-query.php b/includes/google-api-php-client-master/examples/simple-query.php new file mode 100644 index 0000000..c0f1149 --- /dev/null +++ b/includes/google-api-php-client-master/examples/simple-query.php @@ -0,0 +1,87 @@ +setApplicationName("Client_Library_Examples"); +$apiKey = ""; // Change this line. +// Warn if the API key isn't changed. +if (strpos($apiKey, "<") !== false) { + echo missingApiKeyWarning(); + exit; +} +$client->setDeveloperKey($apiKey); + +$service = new Google_Service_Books($client); + +/************************************************ + We make a call to our service, which will + normally map to the structure of the API. + In this case $service is Books API, the + resource is volumes, and the method is + listVolumes. We pass it a required parameters + (the query), and an array of named optional + parameters. + ************************************************/ +$optParams = array('filter' => 'free-ebooks'); +$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams); + +/************************************************ + This call returns a list of volumes, so we + can iterate over them as normal with any + array. + Some calls will return a single item which we + can immediately use. The individual responses + are typed as Google_Service_Books_Volume, but + can be treated as an array. + ***********************************************/ +echo "

Results Of Call:

"; +foreach ($results as $item) { + echo $item['volumeInfo']['title'], "
\n"; +} + +/************************************************ + This is an example of deferring a call. + ***********************************************/ +$client->setDefer(true); +$optParams = array('filter' => 'free-ebooks'); +$request = $service->volumes->listVolumes('Henry David Thoreau', $optParams); +$results = $client->execute($request); + +echo "

Results Of Deferred Call:

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