PHP CURL BORRAR solicitud
Estoy intentando hacer una solicitud DELETE http usando PHP y cURL.
He leído cómo hacerlo en muchos lugares, pero nada parece funcionar para mí.
Así es como lo hago:
public function curl_req($path,$json,$req)
{
$ch = curl_init($this->__url.$path);
$data = json_encode($json);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $req);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data)));
$result = curl_exec($ch);
$result = json_decode($result);
return $result;
}
Entonces sigo adelante y uso mi función:
public function deleteUser($extid)
{
$path = "/rest/user/".$extid."/;token=".$this->__token;
$result = $this->curl_req($path,"","DELETE");
return $result;
}
Esto me da el error interno del servidor HTTP. En mis otras funciones que usan el mismo método curl_req con GET y POST, todo va bien.
Entonces, ¿qué estoy haciendo mal?