Comments on: PHP: Amazon S3 Stream Wrapper http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html Cesar D. Rodas, web development. Technology news. PHP, MySQL, Apache, C, Bash, ASM Thu, 07 Aug 2008 05:31:32 +0000 http://wordpress.org/?v=2.1.1 By: James http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-560 James Tue, 25 Sep 2007 18:44:16 +0000 http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-560 Great idea Caesar, I'll be sure to look at it more closely when I have a chance to play with S3 a little more. Are you using this for any live projects or production sites? How stable is it? Great idea Caesar, I’ll be sure to look at it more closely when I have a chance to play with S3 a little more. Are you using this for any live projects or production sites? How stable is it?

]]>
By: meneame.net http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-564 meneame.net Wed, 26 Sep 2007 18:55:16 +0000 http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-564 <strong>Servidores S3 de Amazon desde PHP [ENG]...</strong> Un stream wrapper (que se puede manejar como un filesystem local) para manejar los servidores S3 de Amazon (Amazon Simple Storage Service). S3 es un servicio de almacenamiento escalabe de bajo coste para ser utilizado por aplicaciones. Permite hasta ci... Servidores S3 de Amazon desde PHP [ENG]…

Un stream wrapper (que se puede manejar como un filesystem local) para manejar los servidores S3 de Amazon (Amazon Simple Storage Service). S3 es un servicio de almacenamiento escalabe de bajo coste para ser utilizado por aplicaciones. Permite hasta ci…

]]>
By: www.programame.net http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-568 www.programame.net Thu, 27 Sep 2007 19:35:22 +0000 http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-568 <strong>Servidores S3 de Amazon desde PHP [ENG]...</strong> Un stream wrapper (que se puede manejar como un filesystem local) para manejar los servidores S3 de Amazon (Amazon Simple Storage Service). S3 es un servicio de almacenamiento escalabe de bajo coste para ser utilizado por aplicaciones. Permite hasta ci... Servidores S3 de Amazon desde PHP [ENG]…

Un stream wrapper (que se puede manejar como un filesystem local) para manejar los servidores S3 de Amazon (Amazon Simple Storage Service). S3 es un servicio de almacenamiento escalabe de bajo coste para ser utilizado por aplicaciones. Permite hasta ci…

]]>
By: Tolan http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-570 Tolan Fri, 28 Sep 2007 13:17:41 +0000 http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-570 Hi, I'd love a copy of your class if possible. Cheers! Tolan. Hi, I’d love a copy of your class if possible.

Cheers!

Tolan.

]]>
By: Alan http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-671 Alan Sun, 25 Nov 2007 05:39:35 +0000 http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-671 This is great Caesar. I would like to use your code in my project, however, I am only able to use GNU licensed code. I am fully willing to give you full credit for it and will provide you with a link to the project. Would you be willing to dual license it under BSD & GNU? Alan This is great Caesar. I would like to use your code in my project, however, I am only able to use GNU licensed code. I am fully willing to give you full credit for it and will provide you with a link to the project.

Would you be willing to dual license it under BSD & GNU?

Alan

]]>
By: jim sloan http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-690 jim sloan Wed, 12 Dec 2007 23:05:39 +0000 http://cesarodas.com/2007/09/php-amazon-s3-stream-wrapper.html#comment-690 Thanks for a very practical demonstration of PHP streams. It was very easy to setup; within 10 minutes I was able to use it to do some mass deletes in an S3 bucket that I was cleaning up. I did run into an issue with special characters in the S3 filenames(Keys). The xml_set_character_data_handler() will fire off multiple times if the data contains certain characters. There is some discussion of it in the PHP manual. see: http://us3.php.net/xml_set_character_data_handler I followed the suggestion to append data until "_dirEnd" is called then add it to the array and unset the data. So now the callback functions look like this: /** * Use this to collect the data when parsing XML * @access private * @var string */ var $dataXML; /** * Handle end of XML tags * */ function _dirEnd(&$parser,&$name){ if ($this->actualTag=="KEY") $this->dirList[] = this->dataXML; unset($this->dataXML); unset($this->actualTag); } /** * Handle data of XML tags * * Save in an array when TAG == "KEY" */ function _dirData(&$parser,&$data){ if ($this->actualTag=="KEY") $this->dataXML .= $data; } Thanks for a very practical demonstration of PHP streams. It was very easy to setup; within 10 minutes I was able to use it to do some mass deletes in an S3 bucket that I was cleaning up.

I did run into an issue with special characters in the S3 filenames(Keys). The xml_set_character_data_handler() will fire off multiple times if the data contains certain characters. There is some discussion of it in the PHP manual. see: http://us3.php.net/xml_set_character_data_handler

I followed the suggestion to append data until “_dirEnd” is called then add it to the array and unset the data. So now the callback functions look like this:

/**
* Use this to collect the data when parsing XML
* @access private
* @var string
*/
var $dataXML;

/**
* Handle end of XML tags
*
*/
function _dirEnd(&$parser,&$name){
if ($this->actualTag==”KEY”) $this->dirList[] = this->dataXML;
unset($this->dataXML);
unset($this->actualTag);
}
/**
* Handle data of XML tags
*
* Save in an array when TAG == “KEY”
*/
function _dirData(&$parser,&$data){
if ($this->actualTag==”KEY”) $this->dataXML .= $data;
}

]]>