29

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 _isgetcontents

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

if (_isgetcontents()){
  echo "this is enabled"; // will do an action
}else{
  echo "this is disabled"; // will do another action
}
Cœur
  • 34,719
  • 24
  • 185
  • 251
Reham Fahmy
  • 4,803
  • 15
  • 48
  • 70

2 Answers2

72

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

if( ini_get('allow_url_fopen') ) {
   // lucky me...
} 
Marcin Orlowski
  • 68,918
  • 10
  • 117
  • 136
2

you can also use this method

phpinfo()

to check various configurations.

Faiyaz Alam
  • 1,139
  • 8
  • 27