trampolinejoe Posted December 7, 2008 Share Posted December 7, 2008 Hello, I have a delivery calculator hosted on URL 1 which hosts the backend for 4 different websites. I want to only have a single delivery calculator because if I want change something across all the sites I would like to change it a single time. I need to be able to access the function kept in that file, I need to include it on other domains. I have tried include"www.myurlname.com/deliveryCalc.php"; but it dosnt seem to work. Can anybody please advice. Cheers Quote Link to comment https://forums.phpfreaks.com/topic/135889-include-a-file-on-another-domain/ Share on other sites More sharing options...
glenelkins Posted December 7, 2008 Share Posted December 7, 2008 try using curl or sockets i initially thought of soap, but im not sure if that only works on the server its based on Quote Link to comment https://forums.phpfreaks.com/topic/135889-include-a-file-on-another-domain/#findComment-708412 Share on other sites More sharing options...
glenelkins Posted December 7, 2008 Share Posted December 7, 2008 not sure if this would work without trying it...but maybe its worth a shot eval ( file_get_contents ( "http://domain.com/phpfile.php" ) ); Quote Link to comment https://forums.phpfreaks.com/topic/135889-include-a-file-on-another-domain/#findComment-708417 Share on other sites More sharing options...
trampolinejoe Posted December 7, 2008 Author Share Posted December 7, 2008 Hello, It seems to be working, thanks, I need to check another couple things to be sure. Thanks! Cheers, Joe. Quote Link to comment https://forums.phpfreaks.com/topic/135889-include-a-file-on-another-domain/#findComment-708425 Share on other sites More sharing options...
trampolinejoe Posted December 7, 2008 Author Share Posted December 7, 2008 Hello, I seem to have this error appearing. Parse error: syntax error, unexpected '<' in /home/content/f/i/r/fireplaceshop/html/cubbyhouse/viewOrderOrder.php(14) : eval()'d code on line 1 Cheers Quote Link to comment https://forums.phpfreaks.com/topic/135889-include-a-file-on-another-domain/#findComment-708427 Share on other sites More sharing options...
wildteen88 Posted December 7, 2008 Share Posted December 7, 2008 not sure if this would work without trying it...but maybe its worth a shot eval ( file_get_contents ( "http://domain.com/phpfile.php" ) ); Requesting a file using the HTTP wrapper will not return the PHP source code but the output of the script. Your code will not work. Quote Link to comment https://forums.phpfreaks.com/topic/135889-include-a-file-on-another-domain/#findComment-708449 Share on other sites More sharing options...
glenelkins Posted December 7, 2008 Share Posted December 7, 2008 ah yes i thought it may. i know for a fact it returns HTML but wasnt sure about if it ran the script or not so maybe you should write your external script to return the values you need in a string using file_get_contents() using echo and then do what you need with the string this end like $result = explode ( "&", file_get_contents ( "http://domain.com/script.php" ) ); echo $result[0]; // bob echo $result[1]; // 21 script.php may read: echo "bob&21"; Quote Link to comment https://forums.phpfreaks.com/topic/135889-include-a-file-on-another-domain/#findComment-708519 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.