Soap Client dont throw on exception
i want when my wsdl server is down, SoapClient Throw to Exception, can any body help to me ?
function a()
{
try
{
$wsdl = @new SoapCli开发者_运维知识库ent( 'http://somedomain.com' );
return true;
} catch( Exception $sf )
{
return false;
}
}
var_dump( a() );
i want result of my code is : false but when server down, my page is only white and has not any output
Have you tried catching a SoapFault Exception instead of just a regular Exception?
function a()
{
try
{
$wsdl = @new SoapClient( 'http://somedomain.com' );
return true;
} catch( SoapFault $sf )
{
return false;
}
}
var_dump( a() );
精彩评论