DemoUpdateCdnConfig.php 840 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use Volc\Service\Cdn;
  3. require('../../vendor/autoload.php');
  4. require_once "init.php";
  5. $client = Cdn::getInstance();
  6. $config = new Config();
  7. $client->setAccessKey($config->ak);
  8. $client->setSecretKey($config->sk);
  9. $body = [
  10. 'Domain' => $config->exampleDomain,
  11. 'Origin' => [
  12. [
  13. 'OriginAction' => [
  14. 'OriginLines' => [
  15. [
  16. 'OriginType' => 'primary',
  17. 'InstanceType' => 'ip',
  18. 'Address' => '1.1.1.1',
  19. 'HttpPort' => '80',
  20. 'HttpsPort' => '443',
  21. 'Weight' => '100'
  22. ]
  23. ]
  24. ]
  25. ]
  26. ],
  27. 'OriginProtocol' => 'HTTP'
  28. ];
  29. $response = $client->updateCdnConfig($body);
  30. var_dump($response);