Cloudflare API v1 was deprecated a while back, you should be using v4.
I’d also say that this query is more of a general PHP developer question than a Cloudflare specific one - namely ‘How do I call an API from within PHP’. You might get better info from a Google search of StackOverflow etc. than on here which is more ‘sysadmin’ oriented really.
Having said that, sure someone will chip in with some advice for you.
Hi I’ve tried your code but it showed an error
$data = array(
‘type’ => ‘A’,
‘name’ => ‘test’,
‘content’ => ‘184.105.192.2’,
‘zone_name’ => ‘’.$domain.’’,
‘zone_id’ => ‘’.$zoneid.’’,
‘proxiable’ => ‘true’,
‘proxied’ => true,
‘ttl’ => ‘1’
);
{“success”:false,“errors”:[{“code”:1004,“message”:“DNS Validation Error”,“error_chain”:[{“code”:9021,“message”:“Invalid TTL. Must be between 120 and 2,147,483,647 seconds, or 1 for automatic”}]}],“messages”:,“result”:null}
Same error, 9207, just started happening suddenly a few days ago. I don’t see any changes in the API documentation and the json array looks correct. Anyone solve this yet?
‘proxiable’ is a boolean not a string, so I had to remove the quotation marks. It was working previously as a string, but this must have changed recently.
I see now that you had actually removed that parameter from your adjusted data array for the zone, I didn’t notice that in your response.
I got This {“result”:{“auto_added”:false,“managed_by_apps”:false,“managed_by_argo_tunnel”:false,“source”:“primary”},“created_on”:“2021-01-16T17:46:41.548998Z”,“modified_on”:“2021-01-16T17:46:41.548998Z”},“success”:true,“errors”:,“messages”:}