Reputation: 93
I need to include to my php script external php code which is situated for example by link http://site.com/code.php How could I do it? I tryed all ways which I found in internet but no one works. All methods are good to include text but not php script.
Upvotes: 2
Views: 1175
Reputation: 8990
According to the PHP documentation (http://php.net/manual/en/features.remote-files.php) "As long as allow_url_fopen is enabled in php.ini, you can use HTTP and FTP URLs with most of the functions that take a filename as a parameter. In addition, URLs can be used with the include(), include_once(), require() and require_once() statements (since PHP 5.2.0, allow_url_include must be enabled for these)."
Upvotes: 0
Reputation: 64439
You can only include the code if it is served as text: otherwise everyone would be able to see / use your code.
So the options you have:
include
or require
curl
it. You won't get the source (cannot use its functions etc) but any actions it performs (make file? add something to the database) will be run.Upvotes: 5
Reputation: 7672
It is not possible, unless you can get the source code to it (aka. its published somewhere or it is on a file system you can access).
Upvotes: 0