Jump to content

include() a file


cody7

Recommended Posts

Hi

i 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!!!



Link to comment
https://forums.phpfreaks.com/topic/8002-include-a-file/
Share on other sites

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]<?php
include ('http://www.yoursite.com/yourscript.php');
?>[/code]

This works fine and there is no need to allow remote requests my database.
Link to comment
https://forums.phpfreaks.com/topic/8002-include-a-file/#findComment-29193
Share on other sites

here is an exmple

myfunction.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 2


So idea here is that i can use my function without giving it to my client.

i just want to see

NAME = Joe

as the output


Thanks 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]<?php
include ('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
https://forums.phpfreaks.com/topic/8002-include-a-file/#findComment-29198
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.