0

i have a curl error 60 (SSL: no alternative certificate subject name matches target host name...) I saw in a previous topic that it would be fixed in curl 7.81, but I'm running with 8.2.1... I tried to install a previous version (following this), but it gave me an error -with-openssl was given, but OpenSSL wasn't found. I also tried installing curl 8.1.2 through snap, same error 60. Does anyone have an idea ? (i have Pphp 8.2.10-2ubuntu1 and ubuntu 23.10)

  • The error implies that the hostname from the URL is not found as subject alternative name in the certificate. Before assuming that this is the fault of the client (curl) please make sure first that it works with other clients (wget, browsers, ...). Because in most cases this isn't actually a bug in the client, but a problem in server setup (bad certificate) or use (wrong URL used). – Steffen Ullrich Nov 24 '23 at 10:17
  • Thanks for your answer i can reach the URL through a browser. (it's https://ext.prod-sandbox.api.enedis.fr ; i'm trying to run php example code from here) – arnaud c Nov 24 '23 at 13:13
  • This certificate is valid for apigile-sandbox.api.enedis.fr and *.api.enedis.fr. The latter wildcard would match prod-sandbox.api.enedis.fr but not ext.prod-sandbox.api.enedis.fr (wildcard matches only one label, i.e. only prod-sandbox). This means that curl correctly complains. If it works in the browser you likely use a different URL. – Steffen Ullrich Nov 24 '23 at 13:25
  • thanks but why does he check the certificate, whereas there is curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false) ? – arnaud c Nov 24 '23 at 13:33
  • you probably also need to disable hostname validation, since the certificate does not match the URL - https://curl.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html – Steffen Ullrich Nov 24 '23 at 15:01
  • Thanks, with verifyhost disabled it works, i have no more curlerror :-)

    But i now have a http error : La requête cURL a retourné une erreur status code 404 (404Status reportRuntime ErrorNo matching resource found for given API Request). ...

    – arnaud c Nov 26 '23 at 22:49

0 Answers0