How can you check if a cURL request was successful in PHP?

To check if a cURL request was successful in PHP, you can use the `curl_getinfo()` function to get information about the request, specifically the HTTP response code. A successful request typically returns a response code of 200.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

if(curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200) {
    echo 'cURL request was successful';
} else {
    echo 'cURL request failed';
}

curl_close($ch);