There is a file on a remote server, test.php, I try to connect this file through

include 'http://www.site.ru/test.php'; 

PHP does not generate allow_url_fopen , allow_url_fopen enabled, and allow_url_include also enabled.

I am writing a test variable in the test.php file $test_file = true;

I try to bring it after connection - null ;

In general, is it possible to connect in such a way that everything is read as PHP content?

    1 answer 1

    If the site.ru is configured to handle PHP files, you can’t get the source code this way. You will get the result of the test.php file. You can connect the PHP code from a remote site if it is given without distortion, for example, as a txt file

     include 'http://www.site.ru/test.txt'; 

    PS However, it should be borne in mind that this is quite a dangerous practice (and slowly and not safely), especially if you do not control a remote server. In the professional code, you almost never see such a reception.

    • Now try, the moment - user190134