我想从外部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();
}
}
如何解决此错误?