How can a PHP script on Server B return a specific value to Server A after processing form data?

To return a specific value from a PHP script on Server B to Server A after processing form data, you can use cURL to make a POST request from Server A to Server B. Server B can process the form data and then return the specific value as a response. Server A can then retrieve this value from the response.

// PHP script on Server A
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://serverB.com/process_data.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(['form_data' => $_POST['form_data']]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if ($response !== false) {
    // Process the specific value returned from Server B
    echo $response;
} else {
    echo 'Error: ' . curl_error($ch);
}

curl_close($ch);