Jump to content

How do I include a php file on one domain into another?


RedBoffin

Recommended Posts

Hello,

I have one website on its own domain which has a collection of functions in a php file.

I want to have four other websites (on their own domains) that include this functions php file, so that I only have to maintain the one set of functions. All four websites display the same products but each is branded differently.

I have tried to include the functions file in one of the four websites using include() and no error message is displayed. A call from this website to one of the functions in the functions php file generates this error "Fatal error: Call to undefined function: getintroduction() in /home/hbash/public_html/includes/home.php on line 1".

The first website also calls this function (in an identical manner) and does not generate an error message - it works as intended.

I do not understand why the second website is having problems. Can anyone help me sort this problem out.

Thank you for reading this.

Darren
It is possible. But, you cannot give the file an extension such as PHP. If you do then when you call the file from an external page then the page will be processed by the web server and the result will be returned to the calling page. So, if you are declaring function in the include file, there is no output.

Instead, you need to give the file an extension that the server will not process such as txt or something of your own choosing - doesn't really matter as long as it's not something the server will process.

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.