このスニペットを実行しています:
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.
}
}
プログラムを実行すると、Web サービスの URL から認証エラーが返されます (開発のこの時点では問題ありません)。
私が注目している異常な動作は、私がこれを期待していた間、次のことです。
$ 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"
それは私にこれを与えています:
$ 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"
「PHP致命的エラー」がプログラムを強制終了しないのはなぜですか? そして、try/catch ブロックをエスケープしているのはなぜですか?
どうすればこれを回避できますか?