PHP code example of peakhour-io / peakhour-api

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

    

peakhour-io / peakhour-api example snippets


$client = (new \PeakhourIo\Client(['base_uri' => 'https://www.peakhour.io']))
    ->setAuthApiKey('<API_KEY>')
    ->setDomain('www.example.com');
$response = $client->domains()->flushResources([
    '/about',
    '/blog/1337
]);

$code = $response->getStatusCode();
if ($code !== 202) {
    // Error handling (...)
}