Transfer encoding not supported

Recently i faced a problem with connecting to proxmox api. code

 curl_setopt($ch, CURLOPT_URL,"https://myhost:8006/api2/json/access/ticket");
     $pf = 'username='. urlencode($this->username).'@pve&password='.urlencode($this->password);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $pf);
   curl_exec($ch)

works fine.

but

       curl_setopt($ch, CURLOPT_URL,"https://myhost:8006/api2/json/nodes/ps116/qemu/118/status/stop")
$put_post_heareds[]="CSRFPreventionToken: {$mytokenhere}"
curl_setopt($ch, CURLOPT_HTTPHEADER, $put_post_headers);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_COOKIE, "PVEAuthCookie="{$mycookiedata}");
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
   curl_setopt($ch, CURLOPT_POST, 1);
   curl_exec($ch)

returns 501 chunked transfer encoding not supported

maybe someone can help with this?

i tried to add
curl_setopt($ch, CURLOPT_POSTFIELDS, []),
tried to set
$put_post_http_headers[]=”Expect:”;

tried to set CURLOPT_HTTP_VERSION to CURL_HTTP_VERSION_1_0 as chunked is http1.1 feature…
nothing helps

p.s php8.2. i found that on php7.4 all worked fine. but still can’t find difference…

as answer to comments:

i tried curl_setopt($ch, CURLOPT_ENCODING, ”); – nothing
that post at proxmox forum is mine.

yes, today i found solution. replace
curl_setopt($ch, CURLOPT_POST, 1); with curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

but why this happens? i cant find anything related in php docs…