I'd love to see some code here rather than enjoy some sourse outside. =)
Try this:
http://www.hiteshagrawal.com/amazon-s3-service/amazon-s3-services-create-buckets-using-php
Hope that helps.
Moo
A solution could be to use the Zend_Service_Amazon_S3
component that's provided in Zend Framework -- if it's like many other components of ZF, it might be possible to use it outside of the framework, without having to do too much work to "extract" it.
I've never used it, but there are some examples of code on that manual page, and it doesn't seem too hard to use (quoting) :
require_once 'Zend/Service/Amazon/S3.php';
$s3 = new Zend_Service_Amazon_S3($my_aws_key, $my_aws_secret_key);
$s3->createBucket("my-own-bucket");
$s3->putObject("my-own-bucket/myobject", "somedata");
echo $s3->getObject("my-own-bucket/myobject");
(There are a couple of other examples I won't copy-paste)
An advantage of using a Zend Framework component is that ZF has (mostly) a good reputation, with code that's tested, maintained, supported, ...
Another solution could be to use this Amazon S3 PHP class ; I've never used it either, though...