If you want to run a script using CURL from a server that’s on the internet, you’ll have to provide a means for it to access your localhost XAMPP PC. So that will involve opening the appropriate ports on your router and providing some static address to the thing that’s running the CURL script.
You will need to know the IP address and then you will also need to know the open port for the request.
example:
$ch = curl_init();
/* you will need to change the IP to the IP of the computer you plan on sending it to and port number */
$url = "127.0.0.1:8011;
datacurl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "var1=value1&var2=value2&var_n=value_n");
postcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec ($ch); // execute
curl_close ($ch);
var_dump($output);
After that you will need something listening on that port you can build a custom request handler or use a server such as apache to capture the http request.
Alternate is sockets which is also a viable option but ether way something will need to be on the desktop to accept the incoming request. Please make sure you are doing request validation of the http and some sort of authentication because this can be a major security hole.
well the application on your desktop program will determine the port number. If you have something like wamp installed you could use port 80 or change the port in apache that it listens on . If your not going to use a server you will need to write a socket listener. This can be done by creating a socket from your desktop php and the port and the listen for incoming request on that socket. If you google both you should find plenty of tutorials and walkthroughs that can guide you. Google is your friend when programming. Being a good programmer means being an expert at googling.