From fc9401f04a3aca5abb22f87ebc210de8afe11d32 Mon Sep 17 00:00:00 2001 From: marvin-borner@live.com Date: Tue, 10 Apr 2018 21:50:16 +0200 Subject: Initial Commit --- .../react/socket/examples/11-http-client.php | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 assets/php/vendor/react/socket/examples/11-http-client.php (limited to 'assets/php/vendor/react/socket/examples/11-http-client.php') diff --git a/assets/php/vendor/react/socket/examples/11-http-client.php b/assets/php/vendor/react/socket/examples/11-http-client.php new file mode 100644 index 0000000..2b64a43 --- /dev/null +++ b/assets/php/vendor/react/socket/examples/11-http-client.php @@ -0,0 +1,36 @@ +connect($host. ':80')->then(function (ConnectionInterface $connection) use ($host) { + $connection->on('data', function ($data) { + echo $data; + }); + $connection->on('close', function () { + echo '[CLOSED]' . PHP_EOL; + }); + + $connection->write("GET / HTTP/1.0\r\nHost: $host\r\n\r\n"); +}, 'printf'); + +$loop->run(); -- cgit v1.2.3