diff --git a/tcpclient.php b/tcpclient.php index d92705f..69ba63c 100644 --- a/tcpclient.php +++ b/tcpclient.php @@ -56,7 +56,10 @@ class tcpclient $i = 0; while (empty ($this->ipv4) && empty ($this->ipv6) && $i < 10) { - $nsRecords = dns_get_record ($ipOrName, DNS_AAAA + DNS_A + DNS_CNAME); + $nsRecords = @dns_get_record ($ipOrName, DNS_AAAA + DNS_A + DNS_CNAME); + if ($nsRecords === false) + throw new \Exception ("Can not find the IP for $ipOrName : ". + "DNS Error", 500); foreach ($nsRecords as $val) { if ($val["type"] === "CNAME")