NotifySmtpCheck.php
[Pman.Core] / NotifySmtpCheck.php
index 4688f36..1b37936 100644 (file)
@@ -27,8 +27,25 @@ class Pman_Core_NotifySmtpCheck extends Pman
             return;
         }
         
-        $ip = file_get_contents("https://ifconfig.co/");
-        print_R($ip);exit;
+        $ifconfig = file_get_contents("https://ifconfig.co/");
+        $dom = new DomDocument('1.0', 'utf-8');
+        $dom->loadHTML($ifconfig);
+        
+        $xpath = new DOMXPath($dom);
+        
+        $element = $xpath->query("//code[@class='ip']");
+        
+        if(!$element->length){
+            return;
+        }
+        
+        $ip = $element->item(0)->nodeValue;
+        
+        $cmd = "host {$ip}";
+        
+        $e = `$cmd`;
+        
+        print_R($e);exit;
         
         $error = array();