Firstly, let me show you my code:
index.php
<?php
$id = 123456;
include("https://secure.example.com/log.php");
?>
log.php
<?php
echo $id;
?>
This simple code should, in theory, display 123456 on index.php
, correct? However, I get nothing. I can only assume it's because I'm trying to include a file over a https connection, but is this actually the case? index.php
is NOT on the secure server.
I have the following setting turned on in php.ini
:
allow_url_include = 1
allow_url_fopen = 1
Checking wrappers with the following code:
var_dump(stream_get_wrappers());
Gives me an array showing https
:
array(12) {
[0]=> string(5) "https"
[1]=> string(4) "ftps"
[2]=> string(13) "compress.zlib"
[3]=> string(14) "compress.bzip2"
[4]=> string(3) "php"
[5]=> string(4) "file"
[6]=> string(4) "glob"
[7]=> string(4) "data"
[8]=> string(4) "http"
[9]=> string(3) "ftp"
[10]=> string(4) "phar"
[11]=> string(3) "zip"
}
From the manual, always read the manual:
If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments