I have a site running locally on MAMP Pro (macos) and keep getting cURL errors when I use wp_remote_get()
I've searched and tried multiple solutions, but nothing seems to work.
My code:
$url = site_url() . '/wp-json/wp/v2/my-cpt'; // This works just fine and shows up in the browser correctly
$response = wp_remote_get( $url ); // this outputs the cURL error: "cURL error 60: SSL certificate problem: unable to get local issuer certificate"
I have:
- Downloaded the latest CA file from https://curl.haxx.se/docs/caextract.html
- Replaced the cacert.pem file in my MAMP OpenSSL install: /Applications/MAMP/Library/OpenSSL/certs/cacert.pem
- Opened the two relevant php.ini files. One is located at /Applications/MAMP/conf/php7.4.2/php.ini and the other at /Applications/MAMP/bin/php/php7.4.2/conf/php.ini
- Added the URL to the new cacert.pem curl.cainfo = "/Applications/MAMP/Library/OpenSSL/certs/cacert.pem" openssl.cafile = "/Applications/MAMP/Library/OpenSSL/certs/cacert.pem" openssl.capath = "/Applications/MAMP/Library/OpenSSL/certs"
- I also tried specifying curl.cainfo, openssl.cafile, openssl.capath via the MAMP GUI: File > Edit Template > PHP(php.ini) > 7.4.2