0
我試圖使用PHP從Google Docs API下載/檢索導出的zip文件。Google API:將文檔作爲zip文件下載
我有下載鏈接 - 看起來像這樣 https://docs.google.com/feeds/download/documents/export/Export?id=1m7 ... - 但我該如何下載?
這是我的車費與Zend了:
// Zend Library
$clientLibraryPath = 'zend/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR .
$clientLibraryPath);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Docs');
Zend_Loader::loadClass('Zend_Gdata_Spreadsheets');
$username = '[email protected]';
$password = 'ttttrrrr';
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($username,
$password, $service);
$docs = new Zend_Gdata_Docs($httpClient);
$strURL = "https://docs.google.com/feeds/download/documents/export/
Export?id=1m784NJT....7kVaXtfo&exportFormat=html&format=zip";
$data = $docs->get($strURL);
這幾乎是正確的。但是,zip文件已損壞。
任何想法?
- 更新 - >
使工作(與外部援助):
$data = $docs->get($strURL)->getBody();