I have the following url, but I can't get it working with the spaces. The spaces are in $url2. How can I get the filter in the URL working? Now the filter is ignored. This means I receive all the customers instead of only the client with the specific emailaddress.
$url1 = "https://api.businesscentral.dynamics.com/v2.0/".$tenant."/Prod/ODataV4/Company('Cronus_Test')/CMS_Klant?$";
$url2 = "filter=E_Mail eq '".$row['emailadres']."'";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "".$url1."",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_GETFIELDS => "".$url2."",
CURLOPT_HTTPHEADER => array(
"content-type: application/x-www-form-urlencoded",
"Authorization: Bearer ".$token.""
),
));
$response = curl_exec($curl);
curl_close($curl);