I am making a PHP class that handles some traffic using CURL and everything works very well (with the exception of cookies, but this is one more thing). One thing that doesn't work so great is the curl_close () function, although I don't know why ...
$curlSession = &$tamperCurl->getCURLSession(); var_dump($curlSession); curl_close($curlSession); die();
I previously called curl_exec () and everything worked fine. The result that gives me: resource (6) of type (curl)
Warning : curl_close (): 6 is not a valid cURL handle resource in filename.php on line 58
Does anyone know why this is happening? (var_dump says this is obviously curl).
Addition:
Due to copyright issues, I cannot publish the entire TamperData atm class (it will later be the GPL).
I simplified this:
$tamperCurl = new TamperCurl('test.xml'); echo var_dump($tamperCurl->getCURLSession()); curl_close($tamperCurl->getCURLSession()); die();
The constructor of TamperCurl is as follows:
public function __construct($xmlFilePath, $options=null) { if($options != null) $this->setOptions($options); $this->headerCounter = 0; $this->setXMLHeader($xmlFilePath); $this->init(); } public function init($reuseConnection=false,$resetSettings=null) { $this->curlSession = curl_init(); }
Again the same conclusion: resource (8) of type (curl) PHP Warning: curl_close (): 8 is not a valid cURL handle resource in TamperCurl.php on line 58
source share