I am using the file() function to run a script on a remote server. The script on the remote server needs to return a value to the current server.
$listings = implode('', file("http://www.remoteserver.com/logs/foobarlog.php?name1=$value1&name2=$value2")); echo $listings;
I would like to get a value back from the remote server. How do I tell the remote server to return the value?
I would prefer to have the remote script set a cookie. That script is the one that would need to read the cookie, so it should work, but the remote script won't set the cookie.
Okay, I got it. Let's say that in the remote script I multiply name1 and name2.
$name3 = $name1 * $name2;
Then I just echo $name3.
echo $name3;
then in the local script, $foo holds the echoed value.
$foo = $name3;
I can use $foo however I want.