本文整理汇总了PHP中apiClient::discover方法的典型用法代码示例。如果您正苦于以下问题:PHP apiClient::discover方法的具体用法?PHP apiClient::discover怎么用?PHP apiClient::discover使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类apiClient
的用法示例。
在下文中一共展示了apiClient::discover方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apiClient
<?php
session_start();
require_once "../src/apiClient.php";
$client = new apiClient();
$client->discover('plus');
$client->setScopes(array('https://www.googleapis.com/auth/plus.me'));
if (isset($_GET['logout'])) {
unset($_SESSION['token']);
}
if (isset($_GET['code'])) {
$client->authenticate();
$_SESSION['token'] = $client->getAccessToken();
header('Location: http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
}
if (isset($_SESSION['token'])) {
$client->setAccessToken($_SESSION['token']);
$ret = apiBatch::execute($client->plus->activities->list(array('userId' => 'me', 'collection' => 'public'), 'listActivities'), $client->plus->people->get(array('userId' => 'me'), 'getPerson'));
print "<pre>" . print_r($ret, true) . "</pre>";
} else {
$client->authenticate();
}
示例2: apiClient
<?php
session_start();
require_once "../../src/apiClient.php";
require_once "../../src/contrib/apiBuzzService.php";
$apiClient = new apiClient();
$client->setApplicationName("BuzzFetchPeople_Example_App");
$buzz = new apiBuzzService($apiClient);
$apiClient->discover('buzz');
if (isset($_SESSION['oauth_access_token'])) {
$apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
$token = $apiClient->authenticate();
$_SESSION['oauth_access_token'] = $token;
}
$people = $buzz->people->listPeople('@me', '@following');
echo "<pre>" . print_r($people, true) . "</pre>";