首页 > 解决方案 > How to fix error:1408F10B:SSL routines:ssl3_get_record:wrong version number in guzzle 6 and laravel 5.7

问题描述

I want to get some data from the external API. I am using Guzzle 6 and Laravel 5.7 for doing this. But when I test it in postman, I got an error like this

GuzzleHttp\Exception\ConnectException: cURL error 35: error:1408F10B:SSL routines:ssl3_get_record:wrong version number

This is my code :

  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();
            }
         }

How to fix this error?

标签: phpcurllaravel-5guzzle6

解决方案


推荐阅读