Skip to content

Internet ​

class · pocketmine\utils\Internet · source

Properties ​

$ip ​

php
public static string|false $ip

$online ​

php
public static bool $online

Methods ​

getIP() ​

php
public static function getIP(bool $force = false) : string|false

Lazily gets the External IP using an external service and caches the result

getInternalIP() ​

php
public static function getInternalIP() : string

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.

getURL() ​

php
public static function getURL(string $page, int $timeout = 10, array $extraHeaders = [], &$err = null) : ?\pocketmine\utils\InternetRequestResult

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.

postURL() ​

php
public static function postURL(string $page, array|string $args, int $timeout = 10, array $extraHeaders = [], &$err = null) : ?\pocketmine\utils\InternetRequestResult

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.

simpleCurl() ​

php
public static function simpleCurl(string $page, float $timeout = 10, array $extraHeaders = [], array $extraOpts = [], ?\Closure $onSuccess = null) : \pocketmine\utils\InternetRequestResult

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.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.