cody7 Posted April 20, 2006 Share Posted April 20, 2006 Hii have here a file containing all my functions (myfunction.php)i have created a program on my clients server and i need to use (myfunction.php).my tendency is to include(http://mydomain.com/myfunction.php);but if i do this the function inside it will not be valid right?i can't put myfunction.php to my clients local machine because it contains queries of my tables.so my question is how will i include() myfunction.php as if im just including a file in his local machine?hope my question is clear.Thanks for any help!!! Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted April 20, 2006 Share Posted April 20, 2006 I don't believe you can "include" a PHP file that is located on another server. Your best bet is going to be allowing remote requests to your mysql database. Quote Link to comment Share on other sites More sharing options...
freakus_maximus Posted April 20, 2006 Share Posted April 20, 2006 Yes you can do this type of include. I have several clients setup on their site/page/server to include a script from my server, which processes requests to the database and returns what is needed.This is all I do where I need the script to included. [code]<?phpinclude ('http://www.yoursite.com/yourscript.php');?>[/code]This works fine and there is no need to allow remote requests my database. Quote Link to comment Share on other sites More sharing options...
cody7 Posted April 21, 2006 Author Share Posted April 21, 2006 here is an exmplemyfunction.php (resides in my server: [a href=\"http://mydomain.com/myfunction.php)\" target=\"_blank\"]http://mydomain.com/myfunction.php)[/a][code]<?function give_name(){ return "Joe";}?>[/code]remote.php (resides in my clients server: [a href=\"http://clientdomain.com/remote.php)\" target=\"_blank\"]http://clientdomain.com/remote.php)[/a][code]<?include("http://mydomain.com/myfunction.php");echo "NAME = ".give_name();?>[/code]RESULT:Fatal error: Call to undefined function: give_name() in /home/../../../remote.php on line 2So idea here is that i can use my function without giving it to my client. i just want to see NAME = Joeas the outputThanks for any idea you can give me. [!--quoteo(post=367048:date=Apr 20 2006, 06:55 PM:name=freakus_maximus)--][div class=\'quotetop\']QUOTE(freakus_maximus @ Apr 20 2006, 06:55 PM) [snapback]367048[/snapback][/div][div class=\'quotemain\'][!--quotec--]Yes you can do this type of include. I have several clients setup on their site/page/server to include a script from my server, which processes requests to the database and returns what is needed.This is all I do where I need the script to included. [code]<?phpinclude ('http://www.yoursite.com/yourscript.php');?>[/code]This works fine and there is no need to allow remote requests my database.[/quote] Quote Link to comment Share on other sites More sharing options...
freakus_maximus Posted April 21, 2006 Share Posted April 21, 2006 Well I guess it's going to depend on your function in some way.But, in the example you gave, you should move your echo to the script on your server. The value that is echoed is what will appear on the client side. Quote Link to comment 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.