Is there a way to ensure that the correct script on Server 1 is returned to after processing on Server 2?

When processing a script on Server 2 that needs to return to Server 1, you can pass a unique identifier or token in the request to Server 2. Server 2 can then include this identifier in the response back to Server 1. Server 1 can use this identifier to verify that the correct script is being returned to after processing on Server 2.

// Server 1
$uniqueIdentifier = generateUniqueIdentifier();

// Pass the unique identifier to Server 2
$response = file_get_contents('http://server2.com/process.php?identifier=' . $uniqueIdentifier);

// Server 2
$identifier = $_GET['identifier'];

// Process script on Server 2

// Return to Server 1 with the unique identifier
echo $identifier;