Can we use url in php include ?¿ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can we use url in php include ?¿

This works :- include 'index.php'; But it can't :- include 'www.example.php';

26th Sep 2021, 6:56 AM
Aditya Dhiman
Aditya Dhiman - avatar
4 Answers
+ 1
Thanks but another idea
26th Sep 2021, 7:06 AM
Aditya Dhiman
Aditya Dhiman - avatar
26th Sep 2021, 7:05 AM
AquazDev
AquazDev - avatar
0
Include is for localhost files You can try this file_get_contents('the site here');
26th Sep 2021, 7:08 AM
AquazDev
AquazDev - avatar
0
You need access to modify some settings in php.ini to enable include() of remote files. Quoted from https://www.php.net/manual/en/features.remote-files.php "As long as allow_url_fopen is enabled in php.ini, you can use HTTP and FTP URLs with most of the functions that take a filename as a parameter. In addition, URLs can be used with the include, include_once, require and require_once statements (allow_url_include must be enabled for these)."
26th Sep 2021, 7:37 AM
Ipang