You can use PHP's eval()
function and load code as plaintext through HTTP (I assume that you have: installed HTTP server, public IP address, redirected ports on your router).
$code = file_get_contents("http://your_public_ip/local_code.txt");
eval($code);
Remember to use your public IP and store PHP code in file with other extension, so that code won't be executed on localhost.
Generally, I strongly discourage executing code from remote location, as it is a big security hole. Consider whether it is needed to execute included code. If you just want to include HTML code or some data - use file_get_contents()
and print it usingecho
.