Open maxmcd opened 3 weeks ago
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!
Content-Type
That WOULD come in through the $http_response_header variable, which PHP sets automatically for a given HTTP request. That is being implemented right now, and should be released soon
$http_response_header
Hello, how do I retrieve header values that are set in the script?
I can't seem to figure out how to grab the
Content-Type
header. Thanks!