This is what I looked for in the Internet, take the remote file size example.
If the domain name is normal, the file size is returned.
If the domain name is normal and the file does not exist, it returns false.
Now the problem arises, if the domain name is not normal, like the above address, the domain name cannot be resolved, that is, inaccessible. The error message will be output at this time.
Php_network_getaddresses:getaddrinfo failed: Do not know such a host. In D:\PHPnow-1.5.6\htdocs\webadmin\inc\filesize.php on line 15
How can this error message be removed, in the case of not modifying the Web server configuration, only in the code to solve.
Because I want to use AJAX to fetch file size information. So can not error, an error, JavaScript gets the return value, is the wrong message, which led to the front desk can not run.
Is there a meeting, pointing at the younger brother.
Reply to discussion (solution)
Try
{
$fp = Fsockopen ($host, $port, $err _no, $err _str,30);
}catch (Exception $e)
{
}
Adding an exception handling is still not working.
$fp = @fsockopen ($host, $port, $err _no, $err _str,30);
Block out error messages (This function was born before exception handling)