function clean_challenge()
{
    global $argv, $zone;
    $client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile();
    $response = $client->get("/config-dns/v1/zones/{$zone}");
    $dns = json_decode($response->getBody());
    $dns->zone->soa->serial++;
    $domain = str_replace(".{$zone}", '', $argv[2]);
    foreach ($dns->zone->txt as $k => $txt) {
        if ($txt->name == "_acme-challenge.{$domain}") {
            array_splice($dns->zone->txt, $k, 1);
            break;
        }
    }
    $json = json_encode($dns);
    try {
        $client->post("/config-dns/v1/zones/{$zone}", ['body' => $json, 'headers' => ['Content-Type' => 'application/json']]);
    } catch (GuzzleHttp\Exception\ServerException $e) {
        echo "An error occurred: " . $e->getMessage() . "\n";
    }
}
Example #2
0
 public function __construct()
 {
     $this->client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile('ccu');
 }
Example #3
0
 public function __construct($configSection = null, $configFile = null)
 {
     $this->client = \Akamai\Open\EdgeGrid\Client::createFromEdgeRcFile($configSection, $configFile);
 }