I have a PHP class that is used to POST some data on the server and return the data back using the same open connection. The problem is that this code will try to get the POST data from the first request in the second request ...
curl_setopt(self::$ecurl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt(self::$ecurl, CURLOPT_POSTFIELDS, $data);
$request=curl_exec(self::$ecurl);
curl_setopt(self::$ecurl, CURLOPT_CUSTOMREQUEST, "GET");
$request=curl_exec(self::$ecurl);
So I need an unset method CURLOPT_POSTFIELDS. I tried using curl_setopt(self::$ecurl, CURLOPT_POSTFIELDS, null);, but curl will send the Posting 0 bytes...request header in any case .
Also note that I need to use the exact same connection, so I cannot create another connection through curl_init.
source
share