PHP script for PHPLayer