Project

General

Profile

« Previous | Next » 

Revision c12f206d

Added by Johan van der Vyver over 4 years ago

Support services like AWS and validate returned IP

View differences:

src/etc/inc/services.inc
2215 2215
		curl_close($ip_ch);
2216 2216
		$ip_result_decoded = urldecode($ip_result_page);
2217 2217
		preg_match('=Current IP Address: (.*)</body>=siU', $ip_result_decoded, $matches);
2218
		$ip_address = trim($matches[1]);
2218

  
2219
		if ($matches[1]) {
2220
			$parsed_ip = trim($matches[1]);
2221
		} else {
2222
			$parsed_ip = trim($ip_result_decoded);
2223
		}
2224

  
2225
		preg_match('=((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])=', $parsed_ip, $matches);
2226
		if ($matches[0]) {
2227
			$ip_address = $matches[0];
2228
		}
2219 2229
	}
2220 2230
	return $ip_address;
2221 2231
}

Also available in: Unified diff