本文整理汇总了PHP中Zend_Gdata_Spreadsheets::getSpreadsheetFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_Spreadsheets::getSpreadsheetFeed方法的具体用法?PHP Zend_Gdata_Spreadsheets::getSpreadsheetFeed怎么用?PHP Zend_Gdata_Spreadsheets::getSpreadsheetFeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_Spreadsheets
的用法示例。
在下文中一共展示了Zend_Gdata_Spreadsheets::getSpreadsheetFeed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSpreadsheetId
function getSpreadsheetId()
{
try {
// connect to API
$httpClient = $accessToken->getHttpClient($oauthOptions);
$client = new Zend_Gdata_Docs($httpClient, "leopizzo991");
///$token = new Zend_Oauth_Token_Access();
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
//$client = Zend_Gdata_ClientLogin::getHttpClient("leopizzodb", "l30p1z04d", $service);
$service = new Zend_Gdata_Spreadsheets($client);
// get list of available spreadsheets
$feed = $service->getSpreadsheetFeed();
} catch (Exception $e) {
die('ERROR: ' . $e->getMessage());
}
foreach ($feed->entries as $entry) {
$spreadsheetURL = $entry->id;
}
$spreadsheetKey = basename($spreadsheetURL);
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$feed = $service->getWorksheetFeed($query);
//echo "Spreadsheet Key: <strong>$spreadsheetKey</strong> <br>";
foreach ($feed as $entry) {
$sName = $entry->title->text;
echo "ID of sheet {$sName} is: <strong>" . basename($entry->id) . "</strong><br>";
}
}
示例2: catch
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
Zend_Loader::loadClass('Zend_Gdata_App_AuthException');
Zend_Loader::loadClass('Zend_Http_Client');
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME);
} catch (Zend_Gdata_App_AuthException $ae) {
exit("Error Connecting");
}
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
//$query->setSpreadsheetKey($spreadsheetKey);
//$feed = $spreadsheetService->getWorksheetFeed($query);
$feed = $spreadsheetService->getSpreadsheetFeed($query);
foreach ($feed->entries as $entry) {
echo $entry->id->text;
echo "<br>";
echo $entry->title->text;
}
/*
foreach($feed->entries as $entry){
$wkshtId = explode('/', $entry->id->text);
echo $wkshtId[8];
echo $entry->title->text;
}
if(htmlspecialchars ($_GET['period'])=='current'){
$wkshtIndex=1;
示例3: getAppURL
$_SESSION['REQUEST_TOKEN'] = serialize($consumer->fetchRequestToken(implode(' ', $scopes), $APP_URL . '?action=access_token'));
$consumer->authorizeRequestToken();
break;
case 'access_token':
$_SESSION['ACCESS_TOKEN'] = serialize($consumer->fetchAccessToken());
header('Location: ' . $APP_URL);
break;
default:
if (isset($_SESSION['ACCESS_TOKEN'])) {
$accessToken = unserialize($_SESSION['ACCESS_TOKEN']);
$httpClient = $accessToken->getHttpClient($consumer->getOauthOptions());
$docsService = new Zend_Gdata_Docs($httpClient, $APP_NAME);
$spreadsheetsService = new Zend_Gdata_Spreadsheets($httpClient, $APP_NAME);
// Retrieve user's list of Google Docs and spreadsheet list.
$docsFeed = $docsService->getDocumentListFeed();
$spreadsheetFeed = $spreadsheetsService->getSpreadsheetFeed('http://spreadsheets.google.com/feeds/spreadsheets/private/full?max-results=100');
renderHTML($accessToken, array($docsFeed, $spreadsheetFeed));
} else {
renderHTML();
}
}
/**
* Returns a the base URL of the current running web app.
*
* @return string
*/
function getAppURL()
{
$pageURL = 'http';
if ($_SERVER['HTTPS'] == 'on') {
$pageURL .= 's';
示例4: basename
// http://www.jazzerup.com/blog/google-spreadsheets-api-php-zend
// http://stackoverflow.com/questions/7455239/error-inserting-row-in-google-spreadsheet-using-zend-gdata
// Include the loader and Google API classes for spreadsheets
// Install Zend Framework from above url, add to php.ini include path
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
Zend_Loader::loadClass('Zend_Http_Client');
// Set your Google Docs credentials here
$user = 'your@gmail.com';
$pass = 'password';
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
$feed = $spreadsheetService->getSpreadsheetFeed();
// This is not the url displayed when logged in to Goolge Docs, because
// that would just make sense. Oh, no - instead it has to be abstracted
// away in the object. This is the feed url.
$sheetName = "Sheet1";
foreach ($feed->entries as $entry) {
if ($entry->title->text == $sheetName) {
$spreadsheetURL = $entry->id;
echo "SpreadsheetURL is: {$spreadsheetURL} <br /> \n";
break;
}
}
$spreadsheetKey = basename($spreadsheetURL);
$query = new Zend_Gdata_Spreadsheets_DocumentQuery();
$query->setSpreadsheetKey($spreadsheetKey);
$feed = $spreadsheetService->getWorksheetFeed($query);