Jack Ben Jack Ben - 1 year ago 109
PHP Question

how to check if allow_url_fopen is enabled or not

I'm using the following code

echo 'file_get_contents : ', ini_get('allow_url_fopen') ? 'Enabled' : 'Disabled';

this can get it enabled or disabled

but i would like to make as function say function name is

then i can call it as following any where in my website code

if (_isgetcontents()){
echo "this is enabled"; // will do an action
echo "this is disabled"; // will do another action

~ thanks

Answer Source

Use ini_get() to get the value of certain configuration parameters:

if( ini_get('allow_url_fopen') ) {
   // lucky me...
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download