How can CURL be utilized to send data to a PHP script from a remote client over the web?

To send data to a PHP script from a remote client over the web, you can use CURL to make a POST request with the data included in the request body. The PHP script can then retrieve the data from the request and process it accordingly.

<?php
// Remote client sends data to PHP script using CURL
$data = array(
    'key1' => 'value1',
    'key2' => 'value2'
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/your-php-script.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>