如何修复错误:1408F10B:SSL例程:ssl3_get_record:guzzle 6和laravel 5.7中的版本号错误

时间:2019-07-17 04:13:24

标签: php curl laravel-5 guzzle6

我想从外部API获取一些数据。我正在使用Guzzle 6和Laravel 5.7来做到这一点。但是当我在邮递员中进行测试时,出现了这样的错误

  

GuzzleHttp \ Exception \ ConnectException:cURL错误35:错误:1408F10B:SSL例程:ssl3_get_record:版本号错误

这是我的代码:

  public function testapi(Request $request){
        $xmlrequest = '<soapenv:Envelope 
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  
        xmlns:web="http://systemsunion.com/connect/webservices/"> 
                  <soapenv:Body> 
                      <web:SecurityProviderAuthenticateRequest> 
                         <web:name>username</web:name> 
                         <web:password>password</web:password> 
                      </web:SecurityProviderAuthenticateRequest> 
                   </soapenv:Body> 
                </soapenv:Envelope>';

            $action = 'SecurityProviderAuthenticateRequest';     
            $url = 'https://xx.xx.xx.xx:xxxx/services/Provider?wsdl';
            $client = new Client();     
            $response = $client->post($url, [         
                            'headers' => [           
                                'SOAPAction' => $action, // Add the action              
                                'Content-Type' => 'text/xml'          
                            ],          
                            'body' => $xmlrequest 
                        ]); 

            if ($response) {
                $res = $response->getBody()->getContents();
                $doc = new \DOMDocument();
                $doc->loadXML($res);
                print_r($doc);
                print_r($res);
                exit();
            }
         }

如何解决此错误?

0 个答案:

没有答案