Including a file over a HTTPS connection

mpdc

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"
}
Emi

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.

edited at
0

Comments

0 comments
Login to comment

Related

Including database connection file in php

Including Config file in connection file not working

Consuming a web service over a HTTPS connection

Load XML file via ajax over https

Curl command to download a file over HTTPS

Connection reset when uploading files to Azure Web App over HTTPS

Send binary file over TCP/IP connection

Download big file over bad connection

How to download part of a file over SFTP connection?

Transfer a file over a unstable SSH connection

SSL error 1409442E downloading file over HTTPS with TIdHTTP

Read file from SVN over https using svnkit

Ruby on Rails - How to Save Remote File over HTTPS and Basic Authentication

How do i download pdf file over https with python

Azure IOTHub - Certificate parameter (file path) in HTTPS Connection with C SDK

File transfer over unreliable and slow connection with c#

Playing back a WAV file streamed gradually over a network connection in iOS

Patch a very big binary file over a slow connection

How to get pandas to copy over a xlsx file including it's sheets into a new xlsx file

Uncaught SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS

React app error: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS

How does Nginx Ingress handle an incoming WebSocket Connection over HTTPS (wss:...) when routing to backend over HTTP? (ws:...)?

Linux - Copy a folder including the subfolders, BUT don't copy any file that is over 5MB

Throw an error including the connection string

SonarQube over https

Script Not Working over https

Faye with nodejs over HTTPS

CouchDB Permissions over HTTPS

curl over HTTPS

TOP Ranking

HotTag

Archive