Creating a DNS record with API in PHP

Hey, so I’m trying to create a DNS record using the API in php, however my code doesn’t return anything and there are no records in the DNS

$apikey = 'myapikey';
$email = 'myemail';
$domain = 'mydomain';
$zoneid = 'myzoneid';
$dnsadgeldi = "nameofnewsubdomain";

$ch = curl_init("".$zoneid."/dns_records");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'X-Auth-Email: '.$email.'',
'X-Auth-Key: '.$apikey.'',
'Cache-Control: no-cache',
'purge_everything: true'


$data = array(

'type' => 'CNAME',
'name' => ''.$dnsadgeldi.'',
'content' => ''.$domain.'',
'zone_name' => ''.$domain.'',
'zone_id' => ''.$zoneid.'',
'proxiable' => true,
'proxied' => true,
'ttl' => 0

$data_string = json_encode($data);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);

$sonuc = curl_exec($ch);


Afaik curl_exec will only return a successful response body, so if you receive a 5XX or 4XX code from the API it won’t be returned. Try using curl_error to see if the API is spitting out an error