0

PHP Web アプリケーションで「HTTP 500 内部サーバー エラー」を処理する際に問題に直面しています。
Web アプリが複数の外部 Web サービスにループしてヒットし、それらのいずれかがエラーを超えている場合、他の URL を実行せずにスクリプトが終了します。

以下は、私が取り組んでいるコード スニペットです。
もっと情報が欲しい人がいたら教えてください。

$arrURLs        = array('https://example1.com/abc1', 'https://example1.com/pqr2', 'https://example2.com/abc1', 'https://example2.com/pqr2');
$arrResponse    = array();
foreach( $arrURLs as $strURL ) {
    $soap_options = array('soap_version' => SOAP_1_1,
                            'debug'=>1,
                            'trace'=>1,
                            'exceptions'=>TRUE,
                            'cache_wsdl'=>WSDL_CACHE_NONE,
                            'connection_timeout'=> 500,
                            'stream_context' => stream_context_create(array('ssl' => array('verify_peer'=> false,'verify_peer_name'=>false,) ) ) );
    try{
        $client = new SoapClient( $strURL . '?wsdl', $soap_options );
        $client -> __setLocation( $strURL );
        $response = $client->method1();
        array_push( $arrResponse, $response );
    } catch(\Exception $e) {
        $strError = 'Exception while connecting to URL: ' . $strURL . 'Error Message: ' . $e->getMessage();
        echo $strError;
    }
}
// parse $arrResponse after getting from all web services;

ありがとう。

4

1 に答える 1