Suppress Warnings ??
Posted: Thu Jun 12, 2008 4:08 pm
I'm wondering how to suppress warnings similar to how the @ suppresses exceptions. If these are one and the same in this context please let me know. Here's an example:
if for some reason the SoapClient function can't find the given uri, it fails with a message thus:
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: php_network_getaddresses: getaddrinfo failed: No such host is known.
and then the script dies.
I need something that will catch this and continue. I've tried the following to no avail:
Here's a bit more code that may help show what I'm doing:
Code: Select all
$v = new SoapClient($uri.'?WSDL');
Warning: SoapClient::SoapClient() [function.SoapClient-SoapClient]: php_network_getaddresses: getaddrinfo failed: No such host is known.
and then the script dies.
I need something that will catch this and continue. I've tried the following to no avail:
Code: Select all
@$v = new SoapClient($uri.'?WSDL');
$v = @new SoapClient($uri.'?WSDL');
$v = new @SoapClient($uri.'?WSDL');
Code: Select all
function getSOAPClient($uri){
$v = new SoapClient($uri.'?WSDL');
if(is_object($v)){#,array("exceptions" => 0));
return($v);
}else{
throw new Exception("Can't create SOAP interface to $uri");
}
}
function getAPI($uri){
$r='';
try{
$pos=strpos($uri,'https://');
if($pos!==false){
$v = getSOAPClient($uri);
$r.=var_dump($v->__getFunctions());
$r.=var_dump($v->__getTypes());
}
}catch(Exception $e){
echo $e->getMessage;
}
return($r);
}