Jump to content

[SOLVED] Calling PHP within PHP


Valleriani

Recommended Posts

I have a script that is on serveral sites. It changes constantly, so updating 10 sites is a hassle. What I wanted to know if there is a way to call PHP within PHP, using php itself, or javascript, etc. Simply because I'll place the file that is going to be called on a seperate location where all sites can call from it.

 

Can it be called in a .js file? Using <?php at start ?> at end? or is there a easier way?

Link to comment
https://forums.phpfreaks.com/topic/52404-solved-calling-php-within-php/
Share on other sites

For example:

 

mainfile.php has a function which does it's generic stuff to $content

 

so for example:

MAINFILE.PHP

$content = 'Hello';
$content = $content . ' There!';
include 'http://location.com/Test.php';
echo $content;

 

Test.php

$content = $content . 'TESTING!';

 

Basicly its simply I want it to 'add' the line on reading it. But it doesn't seem to be working. I got the error fixed, but its still not adding 'TESTING' to the end of the line.

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.