|
static | getInternalIP () |
|
static | getIP (bool $force=false) |
|
static | getURL (string $page, int $timeout=10, array $extraHeaders=[], &$err=null) |
|
static | postURL (string $page, array|string $args, int $timeout=10, array $extraHeaders=[], &$err=null) |
|
static | simpleCurl (string $page, float $timeout=10, array $extraHeaders=[], array $extraOpts=[], ?\Closure $onSuccess=null) |
|
|
static string false | $ip = false |
|
static bool | $online = true |
|
Definition at line 66 of file Internet.php.
◆ getInternalIP()
static pocketmine\utils\Internet::getInternalIP |
( |
| ) |
|
|
static |
Returns the machine's internal network IP address. If the machine is not behind a router, this may be the same as the external IP.
- Exceptions
-
Definition at line 116 of file Internet.php.
◆ getIP()
static pocketmine\utils\Internet::getIP |
( |
bool | $force = false | ) |
|
|
static |
Lazily gets the External IP using an external service and caches the result
- Parameters
-
bool | $force | default false, force IP check even when cached |
Definition at line 75 of file Internet.php.
◆ getURL()
static pocketmine\utils\Internet::getURL |
( |
string | $page, |
|
|
int | $timeout = 10, |
|
|
array | $extraHeaders = [], |
|
|
& | $err = null ) |
|
static |
GETs an URL using cURL NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread.
@phpstan-template TErrorVar of mixed
- Parameters
-
int | $timeout | default 10 |
string[] | $extraHeaders | |
string | null | $err | reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation. @phpstan-param list<string> $extraHeaders @phpstan-param TErrorVar $err @phpstan-param-out TErrorVar|string $err |
Definition at line 147 of file Internet.php.
◆ postURL()
static pocketmine\utils\Internet::postURL |
( |
string | $page, |
|
|
array|string | $args, |
|
|
int | $timeout = 10, |
|
|
array | $extraHeaders = [], |
|
|
& | $err = null ) |
|
static |
POSTs data to an URL NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread.
@phpstan-template TErrorVar of mixed
- Parameters
-
string[] | string | $args | |
string[] | $extraHeaders | |
string | null | $err | reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occurred during the operation. @phpstan-param string|array<string, string> $args @phpstan-param list<string> $extraHeaders @phpstan-param TErrorVar $err @phpstan-param-out TErrorVar|string $err |
Definition at line 170 of file Internet.php.
◆ simpleCurl()
static pocketmine\utils\Internet::simpleCurl |
( |
string | $page, |
|
|
float | $timeout = 10, |
|
|
array | $extraHeaders = [], |
|
|
array | $extraOpts = [], |
|
|
?\Closure | $onSuccess = null ) |
|
static |
General cURL shorthand function. NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread.
- Parameters
-
float | $timeout | The maximum connect timeout and timeout in seconds, correct to ms. |
string[] | $extraHeaders | extra headers to send as a plain string array |
array | $extraOpts | extra CURLOPT_* to set as an [opt => value] map |
\Closure | null | $onSuccess | function to be called if there is no error. Accepts a resource argument as the cURL handle. @phpstan-param array<int, mixed> $extraOpts @phpstan-param list<string> $extraHeaders @phpstan-param (\Closure(\CurlHandle) : void)|null $onSuccess |
- Exceptions
-
InternetException | if a cURL error occurs |
Definition at line 196 of file Internet.php.
◆ $ip
string false pocketmine\utils\Internet::$ip = false |
|
static |
◆ $online
bool pocketmine\utils\Internet::$online = true |
|
static |
The documentation for this class was generated from the following file: