{ "info": { "author": "Ken Hilton", "author_email": "kenny2minecraft@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: HTTP Servers" ], "description": "Python PPHP: Hypertext Preprocessor.\n\nPPHP\n\nThis is a spinoff of PHP (PHP: Hypertext Preprocessor) that uses Python instead of the PHP language.\n\nHow to use it:\n\nTo host the server, simply run ``python -m PPHPServer``\n\nTo execute Python code inside a file, use:\n\n````\n\nand output will be recorded in the same way as PHP - through stdout.\n\nExample:\n\n``
Request method:
``\n\nSome special globals:\n\n* ``echo(text)`` - this is equivalent to sys.stdout.write(text)\n* ``escape(text)`` - this is equivalent to PHP's ``htmlspecialchars`` - escapes special HTML characters.\n* ``__script__`` - this is the entire script currently being executed\n* ``__db__`` - this is the server's database, more documentation below\n* ``_GET`` - this is the GET data as a dictionary\n* ``_POST`` - this is the POST data as a dictionary\n* ``_REQUEST`` - this is a combination of _GET and _POST\n* ``_SERVER`` - this is the equivalent of PHP's $_SERVER, with some exceptions described below.\n\nIn _SERVER, the keys ``REQUEST_TIME, HTTP_ACCEPT, HTTP_ACCEPT_CHARSET, HTTP_HOST, HTTP_REFERER, HTTPS, REMOTE_HOST, SERVER_ADMIN, SERVER_SIGNATURE, SCRIPT_NAME, and SCRIPT_URI`` are all not available; and the key ``GATEWAY_INTERFACE`` returns the version of the ``cgi`` module, not the gateway interface.\n\nData for a server can be stored using the global ``__db__``. This is simply a dictionary - you can store and retrieve values as such. Data in ``__db__`` is stored as JSON in the file ``__DATABASE__.json``, under ``~/.pphp`` on Mac or Linux or ``%appdata%/.pphp`` on Windows. Changes to ``__db__`` will only show up in ``__DATABASE__.json`` after all scripts have finished running. **WARNING**: Moving the file will reset that script's data!\n\nThanks to:\n\n* `banana439monkey