Skip to content

[Documentation] Playground Documentation: Playground API Client #2327

@juanmaguitar

Description

@juanmaguitar

The code example at Playground API Client page doesn't clarify from where to get the PHP object in the browser

const php = PHP.load('7.4', {
	requestHandler: {
		documentRoot: "/www"
	}
})
php.writeFile("/www/index.php", `<?php echo file_get_contents("php://input");`);
const result = await php.request({
	method: "GET",
	headers: {
		"Content-Type": "text/plain"
	},
	body: "Hello world!",
	path: "/www/index.php"
});
// result.text === "Hello world!"

For example, at Javascript API page is clear that you need to import the startPlaygroundWeb method from 'https://playground.wordpress.net/client/index.js'

import { startPlaygroundWeb } from 'https://playground.wordpress.net/client/index.js';

Also, under "Running PHP code" there are two subsections:

  • The run() method
  • The request() method

but "The run() method" is empty

cc: @fellyph

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions