Skip to content

Commit dcac545

Browse files
authored
Merge pull request #88 from clue-labs/examples
Fix examples to use updated API
2 parents 7dc5721 + 8d6921f commit dcac545

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/01-http.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// time out connection attempt in 3.0s
2020
$dns = new TimeoutConnector($dns, 3.0, $loop);
2121

22-
$dns->create('www.google.com', 80)->then(function (ConnectionInterface $connection) {
22+
$dns->connect('www.google.com:80')->then(function (ConnectionInterface $connection) {
2323
$connection->on('data', function ($data) {
2424
echo $data;
2525
});

examples/02-https.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// time out connection attempt in 3.0s
2222
$tls = new TimeoutConnector($tls, 3.0, $loop);
2323

24-
$tls->create('www.google.com', 443)->then(function (ConnectionInterface $connection) {
24+
$tls->connect('www.google.com:443')->then(function (ConnectionInterface $connection) {
2525
$connection->on('data', function ($data) {
2626
echo $data;
2727
});

examples/03-netcat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

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

11-
if (!isset($argv[2])) {
12-
fwrite(STDERR, 'Usage error: required arguments <host> <port>' . PHP_EOL);
11+
if (!isset($argv[1])) {
12+
fwrite(STDERR, 'Usage error: required argument <host:port>' . PHP_EOL);
1313
exit(1);
1414
}
1515

@@ -33,7 +33,7 @@
3333

3434
$stderr->write('Connecting' . PHP_EOL);
3535

36-
$dns->create($argv[1], $argv[2])->then(function (ConnectionInterface $connection) use ($stdin, $stdout, $stderr) {
36+
$dns->connect($argv[1])->then(function (ConnectionInterface $connection) use ($stdin, $stdout, $stderr) {
3737
// pipe everything from STDIN into connection
3838
$stdin->resume();
3939
$stdin->pipe($connection);

0 commit comments

Comments
 (0)