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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.