$xpath = new DOMXPath($dom);
- $lists = $xpath->query("code[@class='ip']");
+ $element = $xpath->query("//code[@class='ip']");
+ if(!$element->length){
+ return;
+ }
+
+ $ip = $element->item(0)->nodeValue;
+
+ $cmd = "host {$ip}";
- print_R($lists);exit;
+ $e = `$cmd`;
$error = array();