Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error curl_reset() undefined why?

Tags:

php

curl

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 server. Its giving error

Fatal error: Call to undefined function curl_reset() in /data/html/reviewkiller1.0/controller/searchController.php on line 2054

Note: I have checked for curl extension it is enabled.

Why it is so???

like image 997
Manwal Avatar asked Aug 27 '14 09:08

Manwal


3 Answers

Requires no PHP version updating.

if (!function_exists('curl_reset'))
{
    function curl_reset(&$ch)
    {
        $ch = curl_init();
    }
}
like image 88
tfont Avatar answered Nov 11 '22 18:11

tfont


PHP is old on your server.

From the manual: (PHP 5 >= 5.5.0)

like image 36
Karoly Horvath Avatar answered Nov 11 '22 18:11

Karoly Horvath


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.

like image 13
Manwal Avatar answered Nov 11 '22 18:11

Manwal