Skip to main content

cURL error 60: SSL certificate problem

you can configure Guzzle, which Laravel uses under the hood for HTTP requests, to ignore SSL certificate verification for specific requests. Here's how you can do it:

  1. Open your app/Providers/AppServiceProvider.php file.

  2. Import the necessary classes at the top of the file:

use Illuminate\Support\Facades\Http;
use Illuminate\Support\ServiceProvider;
  1. Inside the register method of the AppServiceProvider class, add the following code to configure Guzzle to ignore SSL verification for specific requests:
public function register()
{
    Http::macro('withoutSslVerification', function () {
        return Http::withOptions([
            'verify' => false,
        ]);
    });
}
  1. Now, in your controller where you make the HTTP request, you can use the withoutSslVerification macro before making the request:
use Illuminate\Support\Facades\Http;

// ...

$response = Http::withoutSslVerification()->get('https://domaine.fr/wp-json/wp/v2/');
$jsonData = $response->json();