Update networktool.php

This commit is contained in:
Namhyeon Go 2018-09-26 19:57:38 +09:00 committed by GitHub
parent 1632fcd1e8
commit 1bea7d4e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,3 +102,18 @@ if(!function_exists("get_os_platform")) {
return $os;
}
}
if(!function_exists("get_network_outbound_addr")) {
function get_network_outbound_addr($protocol="") {
$addr = false;
if(loadHelper("webpagetool")) {
$response = array();
$remote_host = "http://" . ($protocol == "ipv6" ? "ipv6." : "") . "icanhazip.com";
$response = get_web_json($remote_host, "get.cache");
$addr = get_value_in_array("content", $response, $addr);
}
return $addr;
}
}