Skip to content

Commit e72f139

Browse files
committed
Replace 3rd party domains in examples with example.com
While using a big tech 3rd party domain like google.com is guaranteed to work, there are special domains like example.com set up for this since the dawn of the internet.
1 parent 1f3f6b9 commit e72f139

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/13-http-client-blocking.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
require __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');
1010
if (!$stream) {
1111
exit(1);
1212
}
1313
stream_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
1919
Loop::addReadStream($stream, function ($stream) {

examples/14-http-client-async.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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');
1111
if (ip2long($ip) === false) {
1212
echo 'Unable to resolve hostname' . PHP_EOL;
1313
exit(1);
@@ -41,7 +41,7 @@
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) {

0 commit comments

Comments
 (0)