How can PHP be used to send commands from one domain to another while maintaining the IP address of the sending domain?

When sending commands from one domain to another in PHP, the receiving domain will typically see the IP address of the server where the PHP script is running, rather than the IP address of the sending domain. To maintain the IP address of the sending domain, you can use a proxy server or a service like cURL to send the commands. By routing the request through a proxy server, the receiving domain will see the IP address of the proxy server instead of the server running the PHP script.

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://example.com/endpoint');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_PROXY, 'http://proxy-server-ip:port');
$result = curl_exec($ch);
curl_close($ch);

echo $result;
?>