PHP include link to online file

Can I use include (or something similar) to get functions (or something else) from an online file?

Something like this:

include '';


  • Simple Answer: No

    Elaborating: If you use http or https inside your file path, you are literally telling your code to include a file that is on the internet and to use the HTTP / HTTPS protocol in that process.

    As you probably know, php code is executed on the server and is never displayed to users online, but rather the output of the php is displayed.

    For that reason, you won't be able to gain access to your php functions while being a user from online (because that is how you will be perceived with the previous method).

    What you should do is either use relative paths or absolute paths to include php scripts with functions on the same server. Here is some php documentation if you want to read a bit more on how to format the path: PHP DOC