Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if curl is enabled or disabled

Tags:

php

Possible Duplicate:
Writing a function in php

I'm using the following code

echo 'Curl: ', function_exists('curl_version') ? 'Enabled' : 'Disabled'; 

this can get it enabled or disabled

but I would like to make as function say function name is _iscurl

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

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

almost same as my previous question check if allow_url_fopen is enabled or not

like image 803
Reham Fahmy Avatar asked Nov 17 '12 19:11

Reham Fahmy


People also ask

How do I know if cURL is enabled?

Create phpinfo.php file and save. phpinfo; ?> Then go to http://domainname/phpinfo.php to check whether CURL is enabled or not.

How do I know if my cURL is working on Windows?

Open the command prompt, and type “curl -help“. If there are no errors, and displays all the options of curl, it's installed on your Windows 11/10.

How do I know my cURL version?

How do I check the version? If cURL is registered at the command line, you should be able to use where curl to determine the location of curl.exe (the Windows where command is similar to which on *nix-style systems). You can also use curl -V to check your cURL version.


1 Answers

Just return your existing check from a function.

function _isCurl(){     return function_exists('curl_version'); } 
like image 74
John V. Avatar answered Sep 23 '22 13:09

John V.