Include a file via HTTP

Inspired by an earlier thread somewhere (WebmasterWorld?) but have since found this thread on WebmasterWorld:
http://www.webmasterworld.com/php/3763665.htm

NB: This will not work as allow_url_include is Off (set in php.ini or httpd.conf only)

Include a file via HTTP URL, perhaps on another server or may be just local? In what scope is it?

Using the URL, the file is processed at source (as long as the source server is set to process PHP!) and only if the file outputs/returns something can see anything. Even if the file being included is on the same server as we are currently on - I think.

1. Using include('http://local.test/php/includes/helloworld.php')

Some variables are declared in the included file, are they available?

false

USERNAME:

PASSWORD:

Using include('http://local.w3development.co.uk/linkperm/code/includes/remotefile.php')

Some variables are declared in the included file, are they available? No - out of scope.

false

USERNAME:

PASSWORD:

Using file_get_contents('http://local.w3development.co.uk/linkperm/code/includes/remotefile.php')

Some variables are declared in the included file, are they available?

Obviously we are just getting the file contents, so no declared vars could possibly be available. Any PHP is processed at source.

USERNAME:

PASSWORD:

[Home]

VALUE: 12