mirror of
https://github.com/YGGverse/net-php.git
synced 2025-09-10 21:11:53 +00:00
add timeout attribute
This commit is contained in:
parent
a57028f609
commit
1e5b42d407
@ -40,7 +40,7 @@ var_dump(
|
|||||||
|
|
||||||
```
|
```
|
||||||
var_dump(
|
var_dump(
|
||||||
\Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'], &$result = [], &$error = [], $provider = null)
|
\Yggverse\Net\Dig::records('yo.index', ['A', 'AAAA'], &$result = [], &$error = [], $provider = null, $timeout = 5)
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class Dig
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function records(string $hostname, array $records, array &$result = [], array &$error = [], ?string $provider = null): array
|
public static function records(string $hostname, array $records, array &$result = [], array &$error = [], ?string $provider = null, int $timeout = 5): array
|
||||||
{
|
{
|
||||||
if (self::isProvider($provider))
|
if (self::isProvider($provider))
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ class Dig
|
|||||||
{
|
{
|
||||||
if (self::isRecord($record))
|
if (self::isRecord($record))
|
||||||
{
|
{
|
||||||
if ($values = exec(sprintf('dig %s %s %s +short', (string) $provider, (string) $record, (string) $hostname)))
|
if ($values = exec(sprintf('dig %s %s %s +short +time=%d', (string) $provider, $record, $hostname, $timeout)))
|
||||||
{
|
{
|
||||||
foreach (explode(PHP_EOL, $values) as $value)
|
foreach (explode(PHP_EOL, $values) as $value)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user