First version of the PHP script