Sending cURL error

Hello,
I’m trying to send this cURL to deactivate IPv6 but I get error: {“success”:false,“errors”:[{“code”:1007,“message”:“Invalid value for zone setting, ipv6”}],“messages”:,“result”:null}

Php code:

<?php
    $ch = curl_init();
    $data = '{"value":"off"}';
    curl_setopt($ch, CURLOPT_URL, "https://api.cloudflare.com/client/v4/zones/myzoneid/settings/ipv6");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");

    $headers = [ 
	    'X-Auth-Email: myemail',
	    'X-Auth-Key: mykey',
	    'Content-Type: application/json'
	];
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

    $result = curl_exec($ch);
    echo "Result: " . $result;
    curl_close($ch);
?>

What is the problem (mykey and myemail are edited)?

1 Like

It looks ok to my untrained eye. Have you tried the same curl command from the command line?

1 Like

Solved by sending the cURL through the CMD. It was very easy than through PHP :smile:

1 Like