PHP code example of wappr / cloudflare-graphql

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

    

wappr / cloudflare-graphql example snippets




use Wappr\Cloudflare\AnalyticsClient;
use Wappr\Cloudflare\Resources\Account;
use Wappr\Cloudflare\DataSets\HttpRequests\HttpRequests1dGroups;
use Wappr\Cloudflare\SelectionSets\HttpRequests\HttpRequestsSum;

51c6408e00c8159e6e64',
    'b03c6a7ae48351c6408e00c8159e6e64',
    'b03c6a7ae48351c6408e00c8159e6e64',
    'b03c6a7ae48351c6408e00c8159e6e64',
    'b03c6a7ae48351c6408e00c8159e6e64',
];

$threats = 0;

foreach ($accounts as $accountId) {
    $client  = new AnalyticsClient('[email protected]', '03288863723b2ad76ef22646c064e93b');
    $account = new Account($request, $accountId);
    $client->addResource($account);
    $response = json_decode($client->runQuery());

    dump($response);

    $threats = $threats + $response->data->viewer->accounts[0]->httpRequests1dGroups[0]->sum->threats;
}

dump($threats);