Cannot communicate securely with peer: no common encryption algorithm(s)

hi,

I new in here.
i try send “POST” data header & body by using curl.
when i send to another domain, i get error like below:
Notice : Cannot communicate securely with peer: no common encryption algorithm(s)

but if i send to another page on my website (same domain) and i can get the result of curl_exec, and see what I POST.

is this problem on curl? or something else?

Thanks
twasmm

I Googled the error message, and the first result was this post:

This implies that this error is in fact caused by a bug in cURL on CentOS/RedHat systems, in conjunction with certain server settings.

Speaking of server settings, would you mind sharing the URL which does work and doesn’t work so we can check what it supports in terms of SSL or see if we get the same issue?

2 Likes

Hi,

thanks for your response.

my URL: http://twavending.epizy.com/

i already tested “POST” to another page but the same domain, no problem i can send POST.
the same problem when i use ajax can’t POST if cross domain.
like the problem CORS.
below is my code in curl php:

$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_URL, 'http://localhost/rest-api/Vending/App/test.php');
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_ENCODING, "");
curl_setopt($ch2, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch2, CURLOPT_TIMEOUT, 30);
curl_setopt($ch2, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch2, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch2, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch2, CURLINFO_HEADER_OUT, true);    
if (!$log = curl_exec($ch2))
    trigger_error(curl_error($ch2));
$reqHeader = curl_getinfo($ch2, CURLINFO_HEADER_OUT);
curl_close($ch2); 

thanks
twasmm

Hi

do i need add
curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, ‘ECDHE-ECDSA-AES128-GCM-SHA256’);

in this case?

i see this from the link you give me before.

thanks
twasmm

I don’t think this works. This will make cURL connect to it’s internal IP address and ask for the domain localhost. But that request could come from any website on the server, so it wouldn’t know to load the configuration for your website.

This works on your own computer because you probably don’t use multiple IP addresses and virtual hosts, so all requests go to the one and only website on your computer. But this setup won’t work on a web hosting service.

Simply replace http://localhost with http:// followed by your own domain, and it should at least connect to the right website.

2 Likes

i test not just to localhost , but to this link https://sandbox-api.espay.id/
and the result is the same…the error i copy paste before when i try to post to this domain.

thanks
twasmm

hi,

may be need to note, i can post using form to that link or to my localhost. so if POST using form no problem, but when try using curl or ajax can’t POST to that link.
because i want to POST header & body, so i can’t POST using form.

thanks
twasmm

That cURL works differently on your own computer and on our server, that makes sense. But Ajax? Regardless of whether the server application is hosted, it’s your browser which does the heavy lifting.

3 Likes

Hi,

thanks for the response.

why cURL work differently?is that cURL need some configuration or something else?

my suspect more to CORS policy issue, because if i POST in the same domain with cURL or ajax, no problem. but i’m not sure what is the missing, because i already have “key” and POST the header, because I already have the key and POST header, the data needed to request to the server.

is it possible that web hosting is blocking the curl because of the CORS issue?

thanks
twasmm

CORS doesn’t matter for cURL. CORS is only relevant with Ajax. After all, what are your different “origins” when doing a single HTTP request to a URL?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.