reactphp

React PHP get POST data

时光毁灭记忆、已成空白 提交于 2019-12-05 13:10:25
I'm trying to run a simple Web app over a ReactPHP Web server, but I can't figure out where to get POST data coming from an HTML form. The server is defined as: include 'vendor/autoload.php'; register_shutdown_function(function() { echo implode(PHP_EOL, error_get_last()), PHP_EOL; }); $loop = React\EventLoop\Factory::create(); $socket = new React\Socket\Server($loop); $http = new React\Http\Server($socket); $http->on('request', function(React\Http\Request $request, React\Http\Response $response) { print_r($request); $response->writeHead(200, array('Content-type' => 'text/html')); $response-

Is ReactPHP truly asynchronous?

南笙酒味 提交于 2019-12-03 04:14:16
问题 I've been doing some tests on ReactPHP because it looks pretty awesome. I've tested it with the following react/socket code, for a simple socket server. $loop = React\EventLoop\Factory::create(); $socket = new React\Socket\Server($loop); $socket->on('connection', function ($conn) { echo 'New client !'; $conn->on('data', function ($data) use ($conn) { $conn->write("Wow, some data, such cool\n"); $conn->close(); }); }); $socket->listen(1337); $loop->run(); Until this point there's no problem.

Is ReactPHP truly asynchronous?

馋奶兔 提交于 2019-12-02 16:37:57
I've been doing some tests on ReactPHP because it looks pretty awesome. I've tested it with the following react/socket code, for a simple socket server. $loop = React\EventLoop\Factory::create(); $socket = new React\Socket\Server($loop); $socket->on('connection', function ($conn) { echo 'New client !'; $conn->on('data', function ($data) use ($conn) { $conn->write("Wow, some data, such cool\n"); $conn->close(); }); }); $socket->listen(1337); $loop->run(); Until this point there's no problem. The server shows New client ! when a client is connected and the client receives the response. But I