New IP methods

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-15 15:44:33 +01:00
parent fe70af47dc
commit d988b27b16

View File

@ -46,14 +46,24 @@ class Utils extends Thread{
if($ip != ""){ if($ip != ""){
return $ip; return $ip;
}else{ }else{
$ip = trim(strip_tags(Utils::curl_get("http://checkip.dyndns.org/"))); trim(strip_tags(Utils::curl_get("http://checkip.dyndns.org/")));
if(preg_match('/Current IP Address\: (.*)/', $ip, $matches) > 0){ if(preg_match('#Current IP Address\: ([0-9a-fA-F\:\.]*)#', $ip, $matches) > 0){
return $matches[1];
}else{
$ip = Utils::curl_get("http://www.checkip.org/");
if(preg_match('#">([0-9a-fA-F\:\.]*)</span>#', $ip, $matches) > 0){
return $matches[1];
}else{
$ip = Utils::curl_get("http://checkmyip.org/");
if(preg_match('#Your IP address is ([0-9a-fA-F\:\.]*)#', $ip, $matches) > 0){
return $matches[1]; return $matches[1];
}else{ }else{
return false; return false;
} }
} }
} }
}
}
public static function getOS(){ public static function getOS(){
$uname = strtoupper(php_uname("s")); $uname = strtoupper(php_uname("s"));