*I am trying to download/retrieve an exported zip file in PHP:*
// 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');/
// Login
/$username = [email protected]';
$password = 'zzzz';
$service = Zend_Gdata_Docs::AUTH_SERVICE_NAME;
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $password,
$service);
$docs = new Zend_Gdata_Docs($httpClient); /
// The exported zip file I want to download
/$strURL =
"https://docs.google.com/feeds/download/documents/export/Export?id=1S1xq...Z0hM&exportFormat=html&format=zip";/
// Download file (but get to much)
/$data = $docs->get($strURL);/
// Save the file on server
/file_put_contents("test.zip", $data);/
*Everything works fine, except that I download more than just the zip-file.
In top of the downloaded "test-zip" I have:*
HTTP/1.1 200 OK
Content-type: application/zip; charset=UTF-8
X-robots-tag: noindex, nofollow, nosnippet
Content-disposition: attachment; filename="order-12345678.zip"
Transfer-encoding: chunked
Date: Tue, 05 Jul 2011 07:58:11 GMT
Expires: Tue, 05 Jul 2011 07:58:11 GMT
Cache-control: private, max-age=0
X-content-type-options: nosniff
X-frame-options: SAMEORIGIN
X-xss-protection: 1; mode=block
Server: GSE
Connection: close
295B
*If I delete that the file works fine as a zip file. But how do I download
only that part that is the zip file?
Thanks,
Andreas*
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Download-document-as-zip-file-tp3645600p3645600.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]