PHP code example of timclifford / fastly_crudl

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

    

timclifford / fastly_crudl example snippets


// Get stats
$stats = $fastly->send('GET', 'stats?from=1+day+ago');

// Get Keys
$keys = $fastly->send('GET', 'tls/private_keys');

// Get Single Key
$key = $fastly->send('GET', 'tls/private_keys/2XbVFa2kUN1d4rGDBFYkzp');

// Get Domains
$domain = $fastly->send('GET', 'service/'. $fastly_service_id .'/version/1/domain/check_all');
$domains = $fastly->send('GET', 'tls/domains');

// Get activations
$activations = $fastly->send('GET', 'tls/activations');

// Get Certificates
$certificates = $fastly->send('GET', 'tls/certificates');
$certificate = $fastly->send('GET', 'tls/certificates/1JP0gerEJXIxImRnRLckug');

// Purge all
$purge = $fastly->send('POST', 'service/'. $fastly_service_id .'/purge_all');


$private_keys = $fastly->private_keys;

$get_keys = $private_keys->get_private_keys();

$key = $private_keys->get_private_key($id);

$new_key = $private_keys->send_private_key($key, $name = '');


$certificates = $fastly->certificates;

$certificates->get_tls_certificates();
$certificates->get_tls_certificate("1JP0gerEJXIxImRnRLckug");
$certificates->send_tls_certificate($cert);
$certificates->update_tls_certificate($id, $certificate);
$certificates->delete_tls_certificate($id);