This script on the 1st server:
$get_var = 'test';
ob_start();
include('http://example.com/script.php?var=' . $get_var);
ob_end_clean();
echo 'Output from 1st server.' . '<br />';
and this script on the 2nd server
$fp = fopen('./test.txt');
fwrite($fp, $_GET['var']);
fclose($fp);
echo 'Output from 2nd server.';
will display, to the user on the 1st server, this:
and will write this to the file on the 2nd server: