In many php applications, we should use php curl model to access the remote url. However, if php disable curl, you will fail to access. In this tutorial, we will discuss how to detect php curl is enabled or not.
List all php extensions
<?php $extensions = get_loaded_extensions(); print_r($extensions); ?>
From the result, we can find php has enabled extensions, such as bcmath, calendar, ctype, date, ereg, filter and ftp. We can check curl extension is in this list or not.
Detect php curl enable curl or not
<?php function iscurlinstalled(){ if (in_array ('curl', get_loaded_extensions())) { return true; } else{ return false; } } ?>
If this function return true, php has enabled curl extension, otherwise, curl extension will not be used.