I'm having PHP curl script that send some POST variables to CloudFlare API: My fields are:
$fields = array(
'type' => 'A',
'name' => $subdomain.rand(1, 2000),
'content' => Env::getCFIP(),
'proxied' => true,
'ttl' => 1
);
And the curl curl_setopt are:
array(
CURLOPT_POST => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_POSTFIELDS => $fields,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_TIMEOUT => 3,
CURLOPT_VERBOSE => 0,
CURLOPT_FORBID_REUSE => true,
CURLOPT_HTTPHEADER => array(
'X-Auth-Email: '.Env::getCFEmail(),
'X-Auth-Key: '.Env::getCFAuthKey(),
)
);
Default is value of 'proxied' is false. If I skip it in data fields, scripts works. However, I want to have it on true, but I get error:
object(stdClass)[2]
public 'success' => boolean false
public 'errors' =>
array (size=1)
0 =>
object(stdClass)[8]
public 'code' => int 1004
public 'message' => string 'DNS Validation Error' (length=20)
public 'error_chain' =>
array (size=1)
0 =>
object(stdClass)[7]
public 'code' => int 9003
public 'message' => string 'Invalid 'proxied' value, must be a boolean' (length=42)
public 'messages' =>
array (size=0)
empty
public 'result' => null
So my guess is that when cURL send POST request it converts data variables to STRING. Is there any way to stop this behavior?