From aed2fa4465d1f59e7de61a53bfd355867603a9c9 Mon Sep 17 00:00:00 2001 From: edward Date: Thu, 14 Jul 2016 13:29:37 +0800 Subject: [PATCH] NotifySmtpCheck.php --- NotifySmtpCheck.php | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/NotifySmtpCheck.php b/NotifySmtpCheck.php index ca0eb39c..045d8a42 100644 --- a/NotifySmtpCheck.php +++ b/NotifySmtpCheck.php @@ -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 -- 2.39.2