php-wasm icon indicating copy to clipboard operation
php-wasm copied to clipboard

Header values

Open maxmcd opened this issue 1 year ago • 1 comments

Hello, how do I retrieve header values that are set in the script?

const { PhpWeb } = await import("https://cdn.jsdelivr.net/npm/php-wasm/PhpWeb.mjs");
const php = new PhpWeb({ stdout: (x: any) => console.log("out", x), stderr: (x: any) => console.log("err", x) });

let logs: any[] = [];
php.addEventListener("output", (event: any) => logs.push(...event.detail));
const script = "<?php header('Content-Type: image/jpeg'); echo \"Hello, world!\"; ";
const exitCode = await php.run(script);
console.log({ script, exitCode, logs });

I can't seem to figure out how to grab the Content-Type header. Thanks!

maxmcd avatar Oct 24 '24 19:10 maxmcd