File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 44
55require __DIR__ . '/../vendor/autoload.php ' ;
66
7- // connect to www.google .com:80 (blocking call!)
7+ // connect to example .com:80 (blocking call!)
88// for illustration purposes only, should use react/socket instead
9- $ stream = stream_socket_client ('tcp://www.google .com:80 ' );
9+ $ stream = stream_socket_client ('tcp://example .com:80 ' );
1010if (!$ stream ) {
1111 exit (1 );
1212}
1313stream_set_blocking ($ stream , false );
1414
1515// send HTTP request
16- fwrite ($ stream , "GET / HTTP/1.1 \r\nHost: www.google .com \r\nConnection: close \r\n\r\n" );
16+ fwrite ($ stream , "GET / HTTP/1.1 \r\nHost: example .com \r\nConnection: close \r\n\r\n" );
1717
1818// wait for HTTP response
1919Loop::addReadStream ($ stream , function ($ stream ) {
Original file line number Diff line number Diff line change 77
88// resolve hostname before establishing TCP/IP connection (resolving DNS is still blocking here)
99// for illustration purposes only, should use react/socket or react/dns instead!
10- $ ip = gethostbyname ('www.google .com ' );
10+ $ ip = gethostbyname ('example .com ' );
1111if (ip2long ($ ip ) === false ) {
1212 echo 'Unable to resolve hostname ' . PHP_EOL ;
1313 exit (1 );
4141 }
4242
4343 // send HTTP request
44- fwrite ($ stream , "GET / HTTP/1.1 \r\nHost: www.google .com \r\nConnection: close \r\n\r\n" );
44+ fwrite ($ stream , "GET / HTTP/1.1 \r\nHost: example .com \r\nConnection: close \r\n\r\n" );
4545
4646 // wait for HTTP response
4747 Loop::addReadStream ($ stream , function ($ stream ) {
You can’t perform that action at this time.
0 commit comments