Public
Versions
- Open: VersionChanges from v1 to v2+2-1const { PhpWeb } = await import("https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs");export default async function(req: Request): Promise<Response> {
const php = new PhpWeb();let output = "";let headers = new Headers();⦚ 135 unchanged lines ⦚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 output = "";let headers = new Headers();⦚ 135 unchanged lines ⦚ - Open: VersionChanges from v0 to v1+140-2
export default async function (req: Request): Promise<Response> {return Response.json({ ok: true })}const { PhpWeb } = await import("https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs");export default async function(req: Request): Promise<Response> {const php = new PhpWeb();let output = "";let headers = new Headers();php.addEventListener("output", (event: any) => {output += event.detail.join("");});php.addEventListener("header", (event: any) => {const [header, value] = event.detail.split(":");headers.append(header.trim(), value.trim());});const url = new URL(req.url);const method = req.method;// Escape special characters for PHPconst escapeForPHP = (str: string) => str.replace(/['\\]/g, "\\$&");// Prepare request data for PHPconst requestBody = method !== "GET" && method !== "HEAD" ? await req.text() : "";const requestData = {method: method,uri: url.pathname,queryString: url.search.slice(1),headers: Object.fromEntries(req.headers),body: requestBody,};const script = `<?php// Set up superglobals$_SERVER['REQUEST_METHOD'] = '${escapeForPHP(requestData.method)}'; - Open: Version+3-0export default async function (req: Request): Promise<Response> {return Response.json({ ok: true })}
harveyfullstack-phpserve.web.val.run
Updated: August 14, 2024