I am trying to call an URL with PHP to check if it exists and is reachable.
My initial code was
fopen('http://'.$this -> url, 'r');
But it throws the following errors every time an URL is unreachable:
fopen(http://dwzegdzgwedzgew.com): failed to open stream: php_network_getaddresses: getaddrinfo failed
php_network_getaddresses: getaddrinfo failed:
The error operator (@) is ignored in this case as the error isn't thrown by fopen itself but while resolving the asdress. So I thought that should do it:
@fopen(@'http://'.$this -> url, 'r');
but it also goes on throwing the error.
Is there a non-error-throwing possibility to check if an URL exists within PHP before opening it?