NotifySmtpCheck.php
authoredward <edward@roojs.com>
Thu, 14 Jul 2016 05:29:37 +0000 (13:29 +0800)
committeredward <edward@roojs.com>
Thu, 14 Jul 2016 05:29:37 +0000 (13:29 +0800)
NotifySmtpCheck.php

index ca0eb39..045d8a4 100644 (file)
@@ -27,25 +27,7 @@ class Pman_Core_NotifySmtpCheck extends Pman
             return;
         }
         
-        $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`;
-        
-        $helo = substr(array_pop(explode(' ', $e)), 0, -2);
         
         $error = array();
         
@@ -88,4 +70,29 @@ class Pman_Core_NotifySmtpCheck extends Pman
         }
     }
     
+    function getHelo()
+    {
+        $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`;
+        
+        $helo = substr(array_pop(explode(' ', $e)), 0, -2);
+        
+        return $helo;
+    }
+    
 }
\ No newline at end of file