Organization->Manage APIs * Select "CCU APIs" * Create client collections/clients * Add authorization * * Put the credentials in ~/.edgerc as demonstrated by api-kickstart/sample_edgerc */ namespace Akamai\Open\Example; require_once __DIR__ . '/cli/init.php'; class CcuClient { /** * @var \Akamai\Open\EdgeGrid\Client */ protected $client; public function __construct() { $this->client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile('ccu'); } public function postPurgeRequest($hostname, $objects) { $purge_body = [ 'objects' => $objects ]; $response = $this->client->post('/ccu/v3/invalidate/url', [ 'body' => json_encode($purge_body), 'headers' => ['Content-Type' => 'application/json'] ]); return $response; } } $ccu = new CcuClient(); $url = $_POST['url']; echo $url;die(); try { $objects = [ $url ]; $purge = $ccu->postPurgeRequest('data.chinahighlights.com', $objects); $response = json_decode($purge->getBody()); if ($response->httpStatus == 201) { echo '{"msg":"success"}'; } else { echo json_encode($response); } } catch (\GuzzleHttp\Exception\ClientException $e) { header("status: 404 not found"); echo "An error occurred: " . $e->getMessage() . "\n"; }