PHP code example of crasmedia / cloudflare-4

1. Go to this page and download the library: Download crasmedia/cloudflare-4 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/ */

    

crasmedia / cloudflare-4 example snippets


// Set up the request Factory
$factory = new RequestFactory();
$factory->setEmail('FooEmail');
$factory->setKey('FooKey');

// Make a request
$request = $factory->make();
// And run a response
$response = $request->zoneList();

// Alternately, `$response = $factory->zoneList();` does the same thing.

if (!$response->didSucceed()) {
    var_dump($response->getErrors());
    die('Something went wrong!');
} else {
    var_dump($response->getData());
}