How do I send the body through php curl or how do I make a similar request as in js?

Hello. I need to make a similar request like this one:
fetch(’/cms/api/collections/get/ende?token=account-2d62f0209212457d0138c79cefaa06’, {
method: ‘post’,
headers: { ‘Content-Type’: ‘application/json’ },
body: JSON.stringify({
filter: {bol:false},
})
})
.then(res=>res.json())
.then(res => console.log(res))

But in php
I tried to do it like this:
function myapi($method, $target, $token, $data = false) {
$domain = $_SERVER[‘HTTP_HOST’];
$prefix = $_SERVER[‘HTTPS’] ? ‘https://’ : ‘http://’;
$ch = curl_init("$prefix$domain/cms/api/$method$target?token=$token");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
$curlRes1 = curl_exec($ch);
curl_close($ch);
return json_decode($curlRes1, true);
}
$data = json_encode([“filter” => [“bol”=>false]]);

$carts = myapi("collections/get/", "ende", "account-2d62f0209212457d0138c79cefaa06", $data);

But the data wasn’t accepted and it returned a normal array with no conditions. I understand that it’s sent in a body there, and I just send a post request.

Can you tell me what to write in curl for the conditions to be taken into account?

p.s. the whole point is this line:
$data = json_encode(["filter" => ["bol"=>false]]);