I have a php script which gets data from the server A using shell_exec() and then save its results to a variable (I have three variables i.e. $Username, $Status, $IP). Then i display them as needed.
Now i want to send these data to Server B and there i want to display the results of these variables.
I have found some curl script http://www.codingforums.com/archive/index.php/t-160319.html
But i am confused because I am not sure how to do it in a real server , i.e. how to connect to the Server A. In the above line there is nothing mentioned about the connection to ServerB
Also , Will it work on a shared server (which normally uses cPanel).
In the above line there is nothing mentioned about the connection to ServerB
In the script you referenced, the variable $url contains THE OTHER server address.
This need not (necessarily) be a domain name, it could be the IP address of the other server.
One server is ‘feeding’ the values in a PHP script and the other ‘reads’ the output of that page.
If you simply need to pass data (information) between servers, you should investigate SCP.
cURL is for situations where your server must act as a client - most frequently with payment gateways. The SSH2 functions (of which scp is a part) come up more rarely. I’m working on a script right now that does this using this library http://phpseclib.sourceforge.net
I don’t know if there’s anything more recent out there - the version of that library the code I inherited is using was written for PHP 4. It seems to work well enough though.