I would do this:::
Create a crontab on Server A to run a script that will contact a script on Server B every five minutes by using something like $contact = @file("http://www.serverb.com/ascript.php?action=run");
The script on server b will fopen() the file you want to grab and save it as a text file (that way if you have any code in there it will be preserved and not processed). then call a script on server A again and let it know to download the textfile and save it.
Its kinda like the two servers play tag back and forth but its the only thing i can think of thats quick and logical.
So an outline is below:
ServerAfile1.php which is contacted via crontab every 5 min
<?php
$filetocontact = "http://www.serverb.com/ServerBfile1.php";
$contacted = @file($filetocontact . "?action=run");
//now the file has been called and will execute.
?>
ServerBfile1.php which is contacted by the code above.
<?php
if($action == "run") {
$filetosave = "/path/to/thedir/somedir/updatingfile.php";
$fp = fopen($filetosave,"r");
while(!feof($fp)) {
$contents .= fread($fp,2096);
//read the file into a variable.
}
fclose($fp);
$newfp = fopen("./afile.txt","w+");
fwrite($fp,$contents);
fclose($fp);
$contacted = @file("http://www.servera.com/ServerAfile2.php?file=afile.txt");
//that will cause the file to run.
} // I have if action == run so someone wont invoke the script by
// just calling it in the browser.
?>
ServerAfile2.php is contacted by the code above.
<?php
$fp = fopen("http://www.serverb.com/afile.txt","r");
while(!feof($fp)) {
$contents .= fread($fp,2096);
}
fclose($fp);
$savefile = fopen("./filetowrite.php","w+");
fwrite($savefile,$contents);
fclose($savefile);
?>
That should get the job done. Feel free to contact me w/ any questions you may have about it. You may need to play around with permissions a little bit on the files you write.