How can cURL calls to the same SSL URL be optimized for performance in PHP?

To optimize cURL calls to the same SSL URL in PHP for performance, you can reuse the same cURL handle for multiple requests instead of creating a new handle every time. This can improve performance by reducing the overhead of creating and initializing a new cURL handle for each request.

// Initialize cURL handle
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, 'https://example.com/api');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// Make multiple requests using the same cURL handle
$response1 = curl_exec($ch);
$response2 = curl_exec($ch);

// Close cURL handle
curl_close($ch);