tags:

views:

63

answers:

2

Soon I'm going to have 3 identical scripts on 3 different VPS's and I want to have a fourth VPS which will control them all..

So for the sake of this question what I need to do is insert SQL rows and create files on the sub-servers, and the sub-servers also need to send statistical data back to the mother server. What is the most efficient way of doing this?

I was thinking of making scripts on the servers to do the jobs I need and using cURL to send requests to these scripts making use of URL parameters for the data which needs to be transferred, but perhaps there is a better way? Ideally I want it to be as fast as possible because they will most likely be sending requests to each other every second.

+1  A: 

You could use XML-RPC, which exists in many manifestations:

http://us3.php.net/manual/en/book.xmlrpc.php

If you want dead-simple, just use plain HTTP(S) requests, provided you're careful about implementing it.

To perform a simple request, use cURL, file_get_contents, or fopen. This website is packed full of usage examples.

karim79
Simple would be better I suppose, how would I implement a 'plain HTTP request'?
zuk1
Sorry StackOverflow makes me lazy :( Do you mean just a GET request to a PHP file using URL parameters? I'll try and find out more info.
zuk1
karim79
A: 

For simple comminication (ie. a script on server A triggers a script on server B), plain and simple HTTP queries works great. You can add basic authentication (htaccess) to avoid unauthorized people to trigger your script, and stronger security by using HTTPS.

Nicolas