Proqrammer Posted November 13, 2006 Share Posted November 13, 2006 Is there any way to share a variable between two php files on two different servers? Link to comment https://forums.phpfreaks.com/topic/27088-share-a-variable-between-two-php-files-on-two-different-servers/ Share on other sites More sharing options...
printf Posted November 13, 2006 Share Posted November 13, 2006 You could create an include file with serialized data and set some restriction logic that allows each server access. Now I said serialized because it allows you to use a simple function like $vars = unserialize ( file_get_contents ( 'http://www.site.com/file.php' ) );. But if you need more control, you can use [b]include()[/b], but all of these remote calls need URL fopen wrappers to be turned on. Link to comment https://forums.phpfreaks.com/topic/27088-share-a-variable-between-two-php-files-on-two-different-servers/#findComment-123879 Share on other sites More sharing options...
Proqrammer Posted November 13, 2006 Author Share Posted November 13, 2006 Thanks for your replyCan you give me a reference on creating an include file with serialized data? Link to comment https://forums.phpfreaks.com/topic/27088-share-a-variable-between-two-php-files-on-two-different-servers/#findComment-123980 Share on other sites More sharing options...
doni49 Posted November 13, 2006 Share Posted November 13, 2006 You could also pass the variable as part of the URL.file1.php:[code]echo '<a heref="www.server2.com/file2.php?var1=' . $var1 . '&var2=' . $var2 .'>Link to other server<' . '/a' . >'; [/code]file2.php[code]echo "Var 1: " . $_GET['var1'];echo "Var 2: " . $_GET['var2'];[/code] Link to comment https://forums.phpfreaks.com/topic/27088-share-a-variable-between-two-php-files-on-two-different-servers/#findComment-123996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.