H
H
htmluser2017-11-10 11:15:49
Yii
htmluser, 2017-11-10 11:15:49

How to fix cURL error 51: SSL in Guzzle Yii 2?

I installed Guzzle in Yii 2 to send a request to an external partner site and receive a json response from there. But there was a problem. I write the following code:

$client = new Client();
$res = $client->request('GET', 'https://api.site.com');
echo $res->getStatusCode();

As a result, I get an Exception with the text:
cURL error 51: SSL: no alternative certificate subject name matches target host name 'api.site.com' (see curl.haxx.se/libcurl/c/libcurl-errors.html)

Can you please tell me how to get rid of this error or how to get around it? Unfortunately, the partner does not want to do anything for his part.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2017-11-10
@htmluser

It seems to me that cURL swears at an invalid SSL certificate. Install a valid SSL certificate and the error will disappear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question