Rewrite with PHP, support for authentication

The script has been completely rewritten using PHP.

Authentication is not supported using OAuth tokens.