-
Notifications
You must be signed in to change notification settings - Fork 1
/
apiclienttest2.php
55 lines (42 loc) · 1.51 KB
/
apiclienttest2.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/*
// Include the library files
require_once 'google-api-php-client/src/apiClient.php';
require_once 'google-api-php-client/src/contrib/apiBuzzService.php';
// Create the apiClient and Buzz service classes:
$apiClient = new apiClient();
$buzz = new apiBuzzService($apiClient);
// Add the OAuth authentication flow to your app:
// If a oauth token was stored in the session, use that and otherwise go through the oauth dance
session_start();
if (isset($_SESSION['auth_token'])) {
$apiClient->setAccessToken($_SESSION['auth_token']);
} else {
// In a real application this would be stored in a database, and not in the session!
$_SESSION['auth_token'] = $apiClient->authenticate();
}
// Make an API call
$activities = $buzz->listActivities('@consumption', '@me');
// And echo the returned activities
echo '<pre>Activities:\n' . print_r($activities, true) . '</pre>';
*/
?>
<?php
session_start();
require_once "google-api-php-client/src/apiClient.php";
require_once "google-api-php-client/src/contrib/apiEasyhybridService.php";
$apiClient = new apiClient();
$apiClient->addService('books', 'v1');
$easyhybrid = new apiEasyhybridService($apiClient);
$apiClient->discover('books');
if (isset($_SESSION['oauth_access_token'])) {
$apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
$token = $apiClient->authenticate();
$_SESSION['oauth_access_token'] = $token;
}
$docUploadPath = "https://docs.google.com/feeds/documents/private/full?ocr=true";
var_dump($_SESSION);
var_dump($apiClient);
echo "done";
?>