PHP supports opening remote URLs (e.g. http://www.example.com/something.htmnl) using the fopen and similar functions. It is possible to disable this function in the PHP configuration so this quick tip shows how to check if it is possible to open remote URLs.
The configuration option
The configuration option that enables or disables opening remote URLs is "allow_url_fopen" and will appear in the configuration file like this:
Note that this setting can only be set in the main php.ini configuration file so if your hosting provider has disabled it then you will be able to open remote URLs with fopen etc.
Test if it is enabled
To test if opening remote URLs is enabled do this:
If opening remote URLs is not enabled, then you will need to enable this option in the main php.ini configuration or see if your hosting provider will do this for you. Otherwise you will need to use CURL to download files, assuming that CURL is available.
0 comments:
Post a Comment