From d988b27b16f1cb798f276e1b1de8c6656b00f042 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Tue, 15 Jan 2013 15:44:33 +0100 Subject: [PATCH] New IP methods --- src/classes/utils/Utils.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/classes/utils/Utils.php b/src/classes/utils/Utils.php index b2581bd3..5d3f1d87 100644 --- a/src/classes/utils/Utils.php +++ b/src/classes/utils/Utils.php @@ -46,11 +46,21 @@ class Utils extends Thread{ if($ip != ""){ return $ip; }else{ - $ip = trim(strip_tags(Utils::curl_get("http://checkip.dyndns.org/"))); - if(preg_match('/Current IP Address\: (.*)/', $ip, $matches) > 0){ + trim(strip_tags(Utils::curl_get("http://checkip.dyndns.org/"))); + if(preg_match('#Current IP Address\: ([0-9a-fA-F\:\.]*)#', $ip, $matches) > 0){ return $matches[1]; }else{ - return false; + $ip = Utils::curl_get("http://www.checkip.org/"); + if(preg_match('#">([0-9a-fA-F\:\.]*)#', $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]; + }else{ + return false; + } + } } } }