Click here to Skip to main content
14,429,861 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi experts,

is there a possibility in php, to execute an external php script locally?
Meaning something like include(external script).

This is deemed insecure however, and I tried using Curl. However I found
that curl still runs the script on the external server before displaying
on my page.

Is there any way to grab an external script(I don't need to know the code),
and run it locally?

Mehdi Gholam 25-Sep-11 15:24pm
Can't you copy the script to your local site?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I don't believe this is possible - because it would then expose the (other) server side code. And the reason CURL isn't working is because PHP is handling the request and returning the result - as it would do in a browser. If you do not have physical access to the PHP file, then you can not link to it.

Does whatever you need expose an API that you could may take advantage of?
funniezatee 7-Oct-11 9:33am
Actually this script belongs to me, and I intend to allow external servers to run it. However, I do not wish to allow them access to the code. Short of doing some sort of encryption (I heard something about Zend), or obfuscation which is insecure, does creating an API allow this?

However my code does file manipulation, so it would be unwieldy to be sending files of several 100s of MB across servers, which i suppose would be the case if I were to use an API? Is there no way around this, short of giving external parties my script and putting some disclaimer/copyright claim in it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100