> On Jul 11, 2022, at 12:45 PM, paulf@xxxxxxxxxxxxxxxxx wrote: > > On Mon, 11 Jul 2022 12:16:24 -0700 > JEFFRY KILLEN <jekillen@xxxxxxxxxxx> wrote: > >> >> >>> On Jul 11, 2022, at 12:02 PM, paulf@xxxxxxxxxxxxxxxxx wrote: >>> >>> Folks: >>> >>> I have two PHP apps on the same (local) box. One handles financial >>> transactions (A) and the other handles budgeting (B). I want B to >>> query A for information for the budget. So I'm technically querying >>> a remote PHP script from within a different "site" and PHP script >>> on the same box. Like this: >>> >>> http://localhost:8000/budget/get_expenses.php queries >>> http://localhost:8000/finance/expenses.php > > [snip] > >> Hi; >> Both are under the same domain and port. So you can just use require >> or include on expenses.php from get_expenses.php. Though expenses.php >> will have to be readable. > > They're not actually the same "domain". If I try to run the code from > the finance app while in the budget app via include(), its execution > will be relative to the budget app's directory tree. Whereas, the code > to be executed must be executed under the finance app's directory tree. > > Hope that makes sense. > > Paul > Yes, you would be right if the expenses.php script must require or include its own resources. I would actually structure the script so when it is included by the other script the other script can instantiate a class and use a class method or define a function and run that. If you know that the relationship between get_expenses.php and expenses.php is going to be consistent, then you might be able to create a script local to get_expenses that will include the necessary resources used by expenses. I have a system where I use utilities written in php scripts that exist in one location. Scripts that ned access to these resources, the script local to get_expenses.php can in turn use require or include and reference the scripts and resources needed by expenses.php. So in effect what you have is a chain of calls to require or include. It works in my system. I have scripts that create file system segments I call labs. Each lab needs access to utility scripts that are ouside of the labs branch of the file system. So each lab has a script which just requires the external resources. lab/script.php -> requires -> php script including external php scripts. The external php scripts are now available to lab/script.php This may be more complicated that you are able to manage confortably and it may not actually work in your particular context and perspective, but then again mybe it might Best; Jeff k