How to delete dns in php using Cloudflare API?


I am trying to Delete dns record using PHP and for that I am translating CURL example as on cloudflare API docs into PHP as:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $cf_api_baseurl.“zones/”.$zoneid."/dns_records".$record);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$headers = array();
$headers = ‘X-Auth-Email: ‘.$email.’’;
$headers = ‘X-Auth-Key: ‘.$apikey.’’;
$headers = ‘Content-Type: application/json’;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;
if (curl_errno($ch)) {
echo ‘Error:’ . curl_error($ch);
curl_close ($ch);

But I am getting
“code”: 1001,
“error”: “method_not_allowed”

What am I doing wrong? Help please. Thanks

I am also facing same issue. Were you able to solve?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.