What are the potential pitfalls of string concatenation in PHP when using cURL?

When using string concatenation in PHP with cURL, the potential pitfalls include incorrect formatting of the URL, leading to errors in the request. To avoid this issue, it is recommended to use the `http_build_query` function to properly construct the query string parameters.

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

// Base URL
$url = 'http://example.com/api';

// Query parameters
$params = array(
    'param1' => 'value1',
    'param2' => 'value2'
);

// Build the query string
$queryString = http_build_query($params);

// Construct the final URL
$finalUrl = $url . '?' . $queryString;

// Set cURL options and make the request
curl_setopt($ch, CURLOPT_URL, $finalUrl);
// Add more cURL options as needed

// Execute cURL request
$response = curl_exec($ch);

// Close cURL session
curl_close($ch);

// Handle the response
echo $response;