} public function getQueue() { $response = $this->client->get('/ccu/v2/queues/default'); printf("The queue currently has %s items in it\n", json_decode($response->getBody())->queueLength); } public function checkProgress($resource) { $response = $this->client->get($resource); return json_decode($response->getBody()); } public function postPurgeRequest() { $purge_body = ["objects" => ["https://developer.akamai.com/stuff/Akamai_Time_Reference/AkamaiTimeReference.html"]]; printf("Adding %s to queue\n", json_encode($purge_body, JSON_UNESCAPED_SLASHES)); $response = $this->client->post('/ccu/v2/queues/default', ['body' => json_encode($purge_body), 'headers' => ['Content-Type' => 'application/json']]); return $response; } } $ccu = new CcuClient(); try { $ccu->getQueue(); $purge = $ccu->postPurgeRequest(); $progress = $ccu->checkProgress(json_decode($purge->getBody())->progressUri); $seconds_to_wait = $progress->pingAfterSeconds; printf("You should wait %s seconds before checking queue again...\n", $seconds_to_wait); } catch (\GuzzleHttp\Exception\ClientException $e) { // Handle errors echo "An error occurred: " . $e->getMessage() . "\n"; echo "Please try again with --debug or --verbose flags.\n"; }