Skip to content

Commit

Permalink
Merge pull request #263 from WyriHaximus-labs/1.x-replace-google.com-…
Browse files Browse the repository at this point in the history
…with-reactphp.org

Replace 3rd party domains in examples with example.com
  • Loading branch information
clue authored May 5, 2023
2 parents 21914ff + e72f139 commit a78ae0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions examples/13-http-client-blocking.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

require __DIR__ . '/../vendor/autoload.php';

// connect to www.google.com:80 (blocking call!)
// connect to example.com:80 (blocking call!)
// for illustration purposes only, should use react/socket instead
$stream = stream_socket_client('tcp://www.google.com:80');
$stream = stream_socket_client('tcp://example.com:80');
if (!$stream) {
exit(1);
}
stream_set_blocking($stream, false);

// send HTTP request
fwrite($stream, "GET / HTTP/1.1\r\nHost: www.google.com\r\nConnection: close\r\n\r\n");
fwrite($stream, "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n");

// wait for HTTP response
Loop::addReadStream($stream, function ($stream) {
Expand Down
4 changes: 2 additions & 2 deletions examples/14-http-client-async.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// resolve hostname before establishing TCP/IP connection (resolving DNS is still blocking here)
// for illustration purposes only, should use react/socket or react/dns instead!
$ip = gethostbyname('www.google.com');
$ip = gethostbyname('example.com');
if (ip2long($ip) === false) {
echo 'Unable to resolve hostname' . PHP_EOL;
exit(1);
Expand Down Expand Up @@ -41,7 +41,7 @@
}

// send HTTP request
fwrite($stream, "GET / HTTP/1.1\r\nHost: www.google.com\r\nConnection: close\r\n\r\n");
fwrite($stream, "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n");

// wait for HTTP response
Loop::addReadStream($stream, function ($stream) {
Expand Down

0 comments on commit a78ae0b

Please sign in to comment.