PHP code example of fcosantos / cloudflare-dns

1. Go to this page and download the library: Download fcosantos/cloudflare-dns library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fcosantos / cloudflare-dns example snippets

`

cosantos\CloudflareDns\CloudflareDNSUpdater;

// Instantiate the updater with your Cloudflare credentials and base domain
$updater = new CloudflareDNSUpdater(
    'your_zone_id', 
    '[email protected]', 
    'your_api_key', 
    'example.com'
);

// Update a specific DNS record for "subdomain.example.com" (default type "A")
$updater->updateDns('subdomain', 'record_id_for_subdomain', 120, true);

// Update a DNS record of type CNAME for "www.example.com"
$updater->updateDns('www', 'record_id_for_www', 120, true, 'CNAME');