Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
const { PhpWeb } = await import("https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs");
const php = new PhpWeb();
export default async function(req: Request): Promise<Response> {
let logs = [];
php.addEventListener("output", (event: any) => logs.push(...event.detail));
const script = "<?php echo \"Hello, world!\";";
const exitCode = await php.run(script);
return Response.json({ script, exitCode, logs });
}
maxm-php.web.val.run
August 14, 2024