File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?php
22
3+ // Simple plaintext HTTP client example (for illustration purposes only).
4+ // This shows how a plaintext TCP/IP connection is established to then send an
5+ // application level protocol message (HTTP).
6+ // Real applications should use react/http-client instead
7+
38use React \EventLoop \Factory ;
49use React \Socket \Connector ;
510use React \Socket \ConnectionInterface ;
Original file line number Diff line number Diff line change 11<?php
22
3+ // Simple secure HTTPS client example (for illustration purposes only).
4+ // This shows how a secure TLS connection is established to then send an
5+ // application level protocol message (HTTP).
6+ // Real applications should use react/http-client instead
7+
38use React \EventLoop \Factory ;
49use React \Socket \Connector ;
510use React \Socket \ConnectionInterface ;
Original file line number Diff line number Diff line change 11<?php
22
3+ // Simple plaintext TCP/IP and secure TLS client example that pipes console I/O.
4+ // This shows how a plaintext TCP/IP or secure TLS connection is established and
5+ // then everything you type on STDIN will be sent and everything the server
6+ // sends will be piped to your STDOUT.
7+
38use React \EventLoop \Factory ;
49use React \Socket \Connector ;
510use React \Socket \ConnectionInterface ;
813
914require __DIR__ . '/../vendor/autoload.php ' ;
1015
16+ if (!defined ('STDIN ' )) {
17+ echo 'STDIO streams require CLI SAPI ' . PHP_EOL ;
18+ exit (1 );
19+ }
20+
21+ if (DIRECTORY_SEPARATOR === '\\' ) {
22+ fwrite (STDERR , 'Non-blocking console I/O not supported on Microsoft Windows ' . PHP_EOL );
23+ exit (1 );
24+ }
25+
1126if (!isset ($ argv [1 ])) {
1227 fwrite (STDERR , 'Usage error: required argument <host:port> ' . PHP_EOL );
1328 exit (1 );
Original file line number Diff line number Diff line change 11<?php
22
3+ // Simple plaintext HTTP and secure HTTPS client example (for illustration purposes only).
4+ // This shows how an URI parameter can parsed to decide whether to establish
5+ // a plaintext TCP/IP or secure TLS connection and then send an
6+ // application level protocol message (HTTP).
7+ // Real applications should use react/http-client instead
8+
39use React \EventLoop \Factory ;
410use React \Socket \ConnectionInterface ;
511use React \Socket \Connector ;
You can’t perform that action at this time.
0 commit comments