I’m using fopen to generate a price feed.
if (($handle = fopen("http://feedurl", "r")) !== FALSE) {
}
Is there a way to stop this warning if the feed fails:
Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in…
You can use
@to suppress the warning:This is suitable here because you are handling the error condition appropriately. Note that liberal use of the
@sign, in general, to suppress errors and warnings is ill-advised.Per the manual entry for
fopen: