Amazon S3 php source code

The basic php file provided by Amazon AWS in 2006 and updated in 2007 to manage S3 accounts requires the PEAR modules Crypt_HMAC and HTTP_Request.

Today there are several php open source toolkits available which are well documented, easy to set up and offering extended features :

  • undesigned S3 php class :  a standalone Amazon S3 REST implementation for PHP 5.2.x (using CURL), that supports large file uploads and doesn’t require PEAR. The latest version is 0.4.0 published on july 20, 2009. The developer is Donovan Schonknecht, a web/mobile application developer based in Cape Town, South Africa. The sourcecode is available at the Google Code website.
  • Tarzan : a fast, powerful PHP toolkit for building web applications with Amazon Web Services. The latest version is 2.0.5 released on august 14, 2009. The developer is Ryan Parman. The sourcecode is available at the Google Code website. User Metadata is managed if the HTTP header has the prefix x-amz-meta- (example: header : x-amz-meta-city value: Luxembourg).
  • CloudFusion : a rebranded version of Tarzan to better reflect the beyond-Amazon evolution of the product. Tarzan 2.5 will be CloudFusion 2.5 and will come with a refreshed website, documentation, examples, and other goodies. The sourcecode is available at the Google Code website.
  • Amazon GS3 : a stream wrapper to get and send files to Amazon S3, developed by Cesar D. Rodas from Paraguay.

A list of some Amazon S3 php code examples is shown hereafter :

Amazon S3 software clients

Last update : December 10, 2012

To organize/manage/store files on Amazon S3, you need a special software tool.

The following list shows a few selected free 3S clients :

  • S3Fox Organizer : this plugin for the Firefox browser is easy to install. Developed by Suchi Software Solutions, the most recent version is 0.6.
  • S3Browser : this Windows only free S3 tool supports multiple Amazon S3 accounts, S3 metadata editing and bucket sharing on top of other features. The latest version is 3.6.7 and has been released on November 20, 2012. S3 Browser is free for personal use only. Users who run the application in commercial, business, government, or military institutions, or for any other profit activity must purchase a Pro license. The Pro license provides some additional features, e.g. a working user-metadata edition.
  • Cloudberry S3 Explorer : this tool makes managing files in Amazon S3 storage easy. By providing a user interface to Amazon S3 accounts, files, and buckets, CloudBerry lets you manage your files on cloud just as you would on your own local computer. The current version is 3.7 released November 14, 2012. A CloudBerry Explorer PRO version is also available which offers some advanced features over the Freeware version. It makes managing files Amazon S3 easier, more secure and cost efficient.
  • Cyberduck : this open source client is an FTP, SFTP, WebDAV, Cloud Files and Amazon S3 browser for the Mac. It features an easy to use interface with quickly accessible bookmarks. The outline view of the browser allows to browse large folder structures efficiently and you can quickly preview files with Quick Look. (version 4.21 relaesd December 12, 2011)
  • S3fm : this client is the first 100% Ajax file manager application for Amazon S3. It runs directly in your browser as a standalone Javascript application and loads from and communicates directly with Amazon S3 without having to share your access credentials with a 3rd party Web site.
  • Amazon S3 for WordPress : this WordPress plugin (version 0.4) developed by Joe Tan allows you to use Amazon’s Simple Storage Service to host your media for your WordPress powered blog. The plugin was not updated during the last two years.
  • WordPress plugin for Amazon S3 : Donovan Schonknecht created a very simple WordPress plugin for Amazon S3 which uses his Amazon S3 PHP class.

The latest versions of S3Browser and Cloudberry support the new Amazon AWS archive solution Glacier.

There are also some commercial S3 tools available, e.g. JungleDisk, Gladinet Cloud DesktopBucket Explorer, SMEStorage and CrossFTP.

CVS, SVN, Git, Mercurial, Trunk, Tags, Branches, Forks ?

CVS (Concurrent Versioning System) is a free software revision control system in the field of software development. Version control system software keeps track of all work and all changes in a set of files, and allows several developers to collaborate. Dick Grune developed CVS in the 1980s.

CVS became popular in the open source software world and is released under the GNU General Public License. In the early 2000s, many users of CVS began to replace it with Subversion (SVN), which was explicitly designed to circumvent some of the limitations of CVS. As of January 2009, many open source projects have replaced Subversion or CVS with a distributed version control system, such as Git or Mercurial.

Subversion, as an open source version control system, will become a project of the Apache Software Foundation and remains of interest for a lot of projects.

Trunk, Tags and Branches are names of directories commonly used in revision control systems, but there exist no agreed definition. I have the following understanding:

  • Trunk : Main development area. This is where the next major release of the code lives, and generally has all the newest features.
  • Branches : Every time a major version is released, it gets a branch created. This allows developers to fix bugs and to make a new release without having to release the unfinished or untested features.
  • Tags : Every time you release a version (final release, release candidates (RC), and betas) you make a tag for it. This gives you a point-in-time copy of the code as it was at that state, allowing you to go back and reproduce any bugs if necessary in a past version, or re-release a past version exactly as it was.
  • Forks : Separate projects that share a common origin with other source code,e.g. major branches that are not accepted into the trunk by the project stakeholders.

A discussion about this topic can be viewed at the stackoverflow website, more detailed informations are available in the conference paper Streamed Lines: Branching Patterns for Parallel Software Development.

Google Chrome OS : an open source operating system

Two days ago, Google announced on the official Google Blog the open-sourcing  of the project Chromium OS, presented in july 2009. As with the Google Chrome browser, development will be done in the open from this point on, one year before  Google Chrome OS will be ready for users. This means the code is free, accessible to anyone and open for contributions.

The release of Chromium OS includes:

  • Chromium Blog
  • Source code
  • Design docs
  • User interface experiments
  • How to build and contribute
  • Short overview video

The Apache CouchDB Project

Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript. CouchDB also offers incremental replication with bi-directional conflict detection and resolution. CouchDB provides a RESTful JSON API than can be accessed from any environment that allows HTTP requests.

CouchDB is written in Erlang, a robust functional programming language ideal for building concurrent distributed systems. Erlang allows for a flexible design that is easily scalable and readily extensible.

Manage your Amazon S3 Account with Ease

Amazon S3 is a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. Several software clients are available to manage an S3 account with ease, some are listed below:

  • S3 Browser : freeware (version 1.9.7 ; 1.9.8 beta) and pro licence available from NetSDK Software
  • Cyberduck : FTP, SFTP, WebDAV, Cloud Files & Amazon S3 Browser for Mac OS X
  • BucketExplorer : different licenses starting at 49.99$ available for Windows, MAC and Linux
  • FireFox S3 : free plugin for FireFox browser
  • CloudBerry : freeware Windows client
  • CloudBuddy : CloudBuddy Personal is a free tool brought to you by CSS Lab

Same origin policy

In computing, the same origin policy is an important security concept for a number of browser-side programming languages, such as JavaScript. The policy permits scripts running on pages originating from the same site to access each other’s methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites.

The concept of same origin policy is often extended to define roughly compatible security boundaries for other web scripting languages, such as Adobe Flash, or for mechanisms other than direct DOM manipulation, e.g.  XMLHttpRequest (Ajax).

The most popular ways to do cross domain calls via JavaScript are :

  • proxies : the most common approache (your script calls your server, your server makes the call to the remote server and then returns the result back to the client)
  • JSON : callback (the remote server needs to accept an additional parameter: a callback function)
  • Flash : bridge (Flash can enable the capability of remote access by placing a special XML policy-file on the remote server to accept requests from other domains)

Run your web applications on Google App Engine

Google App Engine lets you run your web applications on Google’s infrastructure. App Engine applications are easy to build, easy to maintain, and easy to scale as your traffic and data storage needs grow. You can serve your app from your own domain name or from a free name on the appspot.com domain.

Google App Engine supports apps using standard Java technologies, including the JVM, Java servlets, and the Java programming language—or any other language using a JVM-based interpreter or compiler, such as JavaScript or Ruby. App Engine also features a dedicated Python runtime environment, which includes a fast Python interpreter and the Python standard library. The Java and Python runtime environments are built to ensure that your application runs quickly, securely, and without interference from other apps on the system.

App Engine costs nothing to get started. All applications can use up to 500 MB of storage and enough CPU and bandwidth to support an efficient app serving around 5 million page views a month, absolutely free. When you need more resources and enable billing for your application, your free limits are raised, and you only pay for resources you use above the free levels.  There are no set-up costs and no recurring fees. The resources your application uses, such as storage and bandwidth, are measured by the gigabyte, and billed at competitive rates. You control the maximum amounts of resources your app can consume, so it always stays within your budget.

The Java runtime environment uses Java 6, the App Engine Java SDK supports developing apps using either Java 5 or 6. The Python runtime environment uses Python version 2.5.2. Additional support for Python 3 is being considered for a future release. App Engine provides a powerful distributed data storage service that features a query engine and transactions. Just as the distributed web server grows with your traffic, the distributed datastore grows with your data. You can register up to 10 applications per developer account.

SDK’s are available for Java and Python, a plugin for Eclipse exist, Getting Started guides and other documentations are available at the Google App Engine website.

Informations about prices, billing and budgets are also available on the website. A direct access to the login page is here.

Extract images, links and other data from webpages

There are a few tools available to download all the links and images contained in a webpage. Some freeware and open-source applications are listed herafter :

DownThemAll is a fast, reliable and easy-to-use add-on for Fireofx! It allows you to refine your downloads by fully customizable criteria to get only what you really want!

OutWit Hub is an all-in-one application for extracting and organizing data from online sources. It offers a wealth of data recognition features to simplify Web searches and operates as a free Firefox Add-on compatible with Windows, Mac OS, and Linux.

MapLib : Turn any image into a Google Map

MapLib is an application created by Xiao Yisheng that allows you to upload a large image and instantly apply the Google Maps interface to it for easy viewing. Upload an image as large as 6000 x 6000 and embed it on a website with the Google Maps viewing interface. Large images with abundant depth and detail can be annotated. Detailed business related product photos can be described by owners or other visitors to the image. A large photo with many people or places can be annotated like a Google Map.

MapLib API is still in beta stage. There may be some unexpected bugs. MapLib offers free accounts with limited features, pro accounts for 35 US$ per year with enhanced features and super accounts (call for price) with unlimited features. MapLib.net provides a javascript API to embed generated pictures in a user’s own webpage, with full flexibility.

MapLib offers also a solution called Integrator to let you host the generated maps on your own server, which means, all the generated information, including pictures, php files, javascript files, html files and markers. This allows to make the maps running without connecting to MapLib.net every time. The prices without full sources are 120 US$ for the advanced single site solution (maximum 10 maps) and 300 US$ for the premium single site solution (unlimited number of maps). For the solutions with full sources, to customize the presentation, the prices are 200 US$ and 500 US$.