Skip to content

Commit 4ec7b94

Browse files
committed
Replace 3rd party domains in examples with reactphp.org
While using a 3rd party domain like google.com is guaranteed to work. But so does our own website reactphp.org as it's CDN backed. In my opinion it's appropriate to eat our own dogfood for these kind of things.
1 parent 1f3f6b9 commit 4ec7b94

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 www.reactphp.org: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://www.reactphp.org: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: www.reactphp.org\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('www.reactphp.org');
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: www.reactphp.org\r\nConnection: close\r\n\r\n");
4545

4646
// wait for HTTP response
4747
Loop::addReadStream($stream, function ($stream) {

0 commit comments

Comments
 (0)