Detect if cURL works?

前端 未结 1 700
悲哀的现实
悲哀的现实 2021-01-14 16:20

This is the warning.

Warning: curl_setopt_array() [function.curl-setopt-array]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or

1条回答
  •  悲哀的现实
    2021-01-14 16:49

    That seems to work correctly with safe_mode.

    To check CURL, you can either look for it in the loaded extensions (as you did), or simply:

    function_exists('curl_init');
    

    With regards to the error message, I'm not sure what you're asking. Do you want to suppress the error message?

    You can do something like:

    $old=error_reporting(0); // turn off error reporting
    // do whatever that causes errors
    error_reporting($old);   // turn it back on
    

    0 讨论(0)
提交回复
热议问题