I have this snippet running:
foreach($config as $wsInfo){
try{
$soapClient = new SoapClient($wsInfo['url'],
array('encoding'=>'ISO-8859-1'));
// Some more code that I commented out.
}
catch(Exception $e){
echo "EXCEPTION: \n" . $e->getMessage();
// log it, etc.
}
}
When I run the program the Web Service URL responds me with an authentication error (which is ok at this point of development).
The extrange behavior I'm noting is that, while I was expecting for this:
$ php scan.php -p=/ -c=config.yml
EXCEPTION:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://webservices.myserver.com/api.asmx?WSDL' : failed to load external entity "http://webservices.myserver.com/api.asmx?WSDL"
EXCEPTION:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://webservices.myserver.com/api.asmx?WSDL' : failed to load external entity "http://webservices.myserver.com/api.asmx?WSDL"
It's giving me this:
$ php scan.php -p=/ -c=config.yml
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://webservices.myserver.com/api.asmx?WSDL' : failed to load external entity "http://webservices.myserver.com/api.asmx?WSDL"
in /home/me/project/DFPushSOAP.php on line 34
EXCEPTION:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://webservices.myserver.com/api.asmx?WSDL' : failed to load external entity "http://webservices.myserver.com/api.asmx?WSDL"
PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://webservices.myserver.com/api.asmx?WSDL' : failed to load external entity "http://webservices.myserver.com/api.asmx?WSDL"
in /home/me/project/DFPushSOAP.php on line 34
EXCEPTION:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://webservices.myserver.com/api.asmx?WSDL' : failed to load external entity "http://webservices.myserver.com/api.asmx?WSDL"
Why is a "PHP Fatal error" not killing the program? And why is it escaping the try/catch block?
How can I avoid this?