Fatal error curl_reset() undefined why?

前端 未结 4 1369
别那么骄傲
别那么骄傲 2020-12-17 15:18

I am using curl to request another site for getting data. My code having curl_reset() funciton is working well at localhost, but when i have updated my code to

相关标签:
4条回答
  • 2020-12-17 15:37

    PHP is old on your server.

    From the manual: (PHP 5 >= 5.5.0)

    0 讨论(0)
  • 2020-12-17 15:54

    My PHP version is 5.3 so i was not able to use curl_reset() function.

    Solution

    I was using curl_reset() function for getting response of multiple curl request. So i have removed curl_reset() and used

    curl_setopt($curl_handle, CURLOPT_HTTPGET, 1);
    curl_setopt($curl_handle, CURLOPT_POST, false);
    

    Problem was after post request my get request was not giving response when i have set curl_post to false to my request it works well.

    Conclusion: Its important keep calling setopt to switch between GET and POST request when you are using multiple curl request.

    0 讨论(0)
  • 2020-12-17 15:56

    Here is the solution tested 100% working:

    Error from php-error-log due to using curl_reset with php version 5.4:

    Fatal error: Call to undefined function GuzzleHttp\Handler\curl_reset() in ...
    

    Upgrade to php version 5.5 successfully resolved issue. If you are on cpanel upgrading php version takes only 3 or 4 clicks.

    enjoy!

    Please mark as answered if it resolve the issue. Thanks!

    0 讨论(0)
  • 2020-12-17 16:01

    Requires no PHP version updating.

    if (!function_exists('curl_reset'))
    {
        function curl_reset(&$ch)
        {
            $ch = curl_init();
        }
    }
    
    0 讨论(0)
提交回复
热议问题