SoapFault exception: Could not connect to host

后端 未结 27 1623
-上瘾入骨i
-上瘾入骨i 2020-12-01 07:47

Sometimes fail to call the web service.

This problem happens all the time.

What could be the problem?

Error:
    SoapFault exception: [HTTP]          


        
27条回答
  •  鱼传尺愫
    2020-12-01 08:21

    For me it was a certificate problem. Following worked for me

    $context = stream_context_create([
        'ssl' => [
            // set some SSL/TLS specific options
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        ]
    ]);
    
    $client  = new SoapClient(null, [
        'location' => 'https://...',
        'uri' => '...', 
        'stream_context' => $context
    ]);
    

提交回复
热议问题