尝试使用cURL删除图像但是将NULL作为响应

I have made a custom status and test if it is 2 and on that basis am trying to delete the main image of a product. At first I didn't know that cURL needs special treatment if working with sessions and I got redirected to the admin login screen. This modification is supposed to go into the file admin/controller/catalog/product (using VQMod of course). Only now I'm getting NULL for response.

if((int) $this->request->post['status'] == 2) {
    if(isset($this->request->post['image'])) {
        $params = array(
            'path' => $this->request->post['image']
        );
        $defaults = array(
            CURLOPT_URL => $this->url->link('common/filemanager/delete', 'token=' . $this->session->data['token'], 'SSL'),
            CURLOPT_POST => true,
            CURLOPT_POSTFIELDS => $params,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_COOKIESESSION => true,
            CURLOPT_COOKIEJAR => 'cookie-jar',
            CURLOPT_COOKIEFILE => '/home/u32807/tmp'
        );
        $ch = curl_init();
        curl_setopt_array($ch, $defaults);
        $ouput = curl_exec($ch);
        if($output === false) {
            echo 'Curl error: ' . curl_error($ch);
            die();
        }
        else {
            var_dump($output);
            die();
        }
    }
}

I tried commenting out CURLOPT_POSTFIELDS and also I tried feeding it an empty array, but still NULL. There must thus be something wrong with the way I have set up the connection but I do not know where to start to debug it. Hewp pweeze! :/ OpenCart version is 1.5.6.4.

you need to add one more portion for curl,i.e

CURLOPT_CUSTOMREQUEST=> 'DELETE',

check my function for delete:

public function curl_delete_function($mypath, $json='')

{

$url =$this->__url.$mypath;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL,$url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");

curl_setopt($ch, CURLOPT_POSTFIELDS, $json);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);

$result = json_decode($result);

curl_close($ch);


return $result;

}