Cloudflare API PHP错误

I am trying to add a record to Cloudflare via their API using PHP. For some reason, when I use the same code, the result sometimes gives me success, but at other times, it gives an error saying:

Could not route to /zones/dns_records, perhaps your object identifier is invalid?

and it gives the HTTP response code of 400 and 429. After searching those codes, I learned that the code 429 was something about too many requests. How could I solve this problem?

Unfortunately you are querying the wrong endpoint, the dns_records endpoint is in the format of /zones/:zone_identifier/dns_records

You will need to substitute :zone_identifier with the ID of a given zone, you can get this using the /zones endpoint.

So if you want to add a DNS record using cURL:

curl -X POST "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/dns_records" \
     -H "X-Auth-Email: user@example.com" \
     -H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
     -H "Content-Type: application/json" \
     --data '{"type":"A","name":"example.com","content":"127.0.0.1","ttl":120,"proxied":false}'