-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
39 lines (27 loc) · 1.17 KB
/
index.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
<?php
require_once 'buOAuth2Curl.class.php';
$arrGoogleApiID = [
//set your client id and client secret
'client_id' => '???????',
'client_secret' => '???????',
// INSTALL CORRECTLY redirect_uri ON THIS PAGE !!!
// use redirect.php to create an intermediate redirect if necessary
'redirect_uri' => 'http://localhost/redirect.php?target=http://buOAuth2Curl/search.php',
'scope' => 'email profile https://www.googleapis.com/auth/photoslibrary',
];
session_start();
$gApi = new buOAuth2Curl\buGooglePhoto( $arrGoogleApiID );
if( $gApi->checkAuth() ){// authorized let's get to work
echo "Hello, authorization successful!";
$userInfo = $gApi->getUserInfo();
echo '<pre>'; print_r($userInfo); echo '</pre>';
echo "Other examples: <a href='search.php'>search.php</a>; <a href='download.php'>download.php all files</a>";
while( $res = $gApi->getItems() ){
$gApi->printItems($res);
echo '<pre>'; print_r($gApi); echo '</pre>';
}
echo '<pre>Last: '; print_r($gApi); echo '</pre>';
} else { // NO authorization displaying a link to the server
$urlAuth = $gApi->getLinkAuth();
echo '<pre>'; print_r($urlAuth); echo '</pre>';
}