|
|
|
@ -12,7 +12,7 @@ Network Library for PHP with native Yggdrasil support
@@ -12,7 +12,7 @@ Network Library for PHP with native Yggdrasil support
|
|
|
|
|
|
|
|
|
|
#### Check socket is open |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
var_dump( |
|
|
|
|
\Yggverse\Net\Socket::isOpen('yo.index', 80) |
|
|
|
|
); |
|
|
|
@ -20,7 +20,7 @@ var_dump(
@@ -20,7 +20,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
#### Check host valid |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
var_dump( |
|
|
|
|
\Yggverse\Net\Socket::isHost('yo.index') |
|
|
|
|
); |
|
|
|
@ -28,7 +28,7 @@ var_dump(
@@ -28,7 +28,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
#### Check port valid |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
var_dump( |
|
|
|
|
\Yggverse\Net\Socket::isPort(80) |
|
|
|
|
); |
|
|
|
@ -38,7 +38,7 @@ var_dump(
@@ -38,7 +38,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
#### Resolve records |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
var_dump( |
|
|
|
|
\Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'], &$result = [], &$error = [], $provider = null, $timeout = 5) |
|
|
|
|
); |
|
|
|
@ -46,7 +46,7 @@ var_dump(
@@ -46,7 +46,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
#### Check hostname valid |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
var_dump( |
|
|
|
|
\Yggverse\Net\Dig::isHostName('yo.index') |
|
|
|
|
); |
|
|
|
@ -54,7 +54,7 @@ var_dump(
@@ -54,7 +54,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
#### Check record valid |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
var_dump( |
|
|
|
|
\Yggverse\Net\Dig::isRecord('A') |
|
|
|
|
); |
|
|
|
@ -62,7 +62,7 @@ var_dump(
@@ -62,7 +62,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
#### Check record value valid |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
var_dump( |
|
|
|
|
\Yggverse\Net\Dig::isRecordValue('A', '127.0.0.1') |
|
|
|
|
); |
|
|
|
@ -72,7 +72,7 @@ var_dump(
@@ -72,7 +72,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
#### Init resolver |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
$resolve = new \Yggverse\Net\Resolve( |
|
|
|
|
[ |
|
|
|
|
'A', |
|
|
|
@ -88,7 +88,7 @@ $resolve = new \Yggverse\Net\Resolve(
@@ -88,7 +88,7 @@ $resolve = new \Yggverse\Net\Resolve(
|
|
|
|
|
|
|
|
|
|
#### Get resolved URL string |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
$resolved = $resolve->url( |
|
|
|
|
'https://en.wikipedia.org/wiki/Domain_Name_System' |
|
|
|
|
// next arguments contain debug variables and new address object |
|
|
|
@ -104,7 +104,7 @@ if ($resolved)
@@ -104,7 +104,7 @@ if ($resolved)
|
|
|
|
|
|
|
|
|
|
#### Resolve Address object |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
$resolved = $resolve->address( |
|
|
|
|
new \Yggverse\Net\Address( |
|
|
|
|
'https://en.wikipedia.org/wiki/Domain_Name_System' |
|
|
|
@ -144,7 +144,7 @@ Different operations with address parts:
@@ -144,7 +144,7 @@ Different operations with address parts:
|
|
|
|
|
|
|
|
|
|
**Document root** |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
$base = new \Yggverse\Net\Address( |
|
|
|
|
'http://yo.ygg/a1/b1/c1' |
|
|
|
|
); |
|
|
|
@ -162,7 +162,7 @@ var_dump(
@@ -162,7 +162,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
**Current folder** |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
$base = new \Yggverse\Net\Address( |
|
|
|
|
'http://yo.ygg/a1/b1/c1' |
|
|
|
|
); |
|
|
|
@ -180,7 +180,7 @@ var_dump(
@@ -180,7 +180,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
**Ending slash** |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
$base = new \Yggverse\Net\Address( |
|
|
|
|
'http://yo.ygg/a1/b1/c1/' |
|
|
|
|
); |
|
|
|
@ -198,7 +198,7 @@ var_dump(
@@ -198,7 +198,7 @@ var_dump(
|
|
|
|
|
|
|
|
|
|
**All options** |
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
``` php |
|
|
|
|
$base = new \Yggverse\Net\Address( |
|
|
|
|
'http://user:password@yo.ygg/a1/b1/c1?attribute=value#anchor' |
|
|
|
|
); |
|
|
|
|