Generate expiring urls for Amazon S3 via a WordPress Plugin
I am a .net developer and haven’t done any PHP work ever. But I use WordPress and for some time now I have been looking for a plugin that could generate a URL for Amazon S3 that is “signed” and will expire after a certain amount of time.
I posted the question on both WordPress and amazon forums but haven’t got any replies. Well .. maybe I did not explain my problem well or nobody else is interested in this.
So I figured I had to take care of this myself. And as I said. I’m a total newbie in both PHP and WordPress plugins so my plugin is probably really really stupid and I would be happy if somebody could send suggestions on how to make it better. But it works.
How does it work?
You just add
[S3 bucket=yourbucket text=your link text]the_object_name.txt[/S3]
to your post or page and it will generate expiring URLs that no leecher can link to. If you don’t supply and link text it will not generate a link and just print the URL. I use the same bucket names as URLs (like netplay.whoa.nu) and if you use Amazon standard URLs you must change this.