DemoAddCdnDomain.php 865 B

12345678910111213141516171819202122232425262728293031323334353637
  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->operateDomain,
  11. 'ServiceType' => 'web',
  12. 'Origin' => [
  13. [
  14. 'OriginAction' => [
  15. 'OriginLines' => [
  16. [
  17. 'OriginType' => 'primary',
  18. 'InstanceType' => 'ip',
  19. 'Address' => '1.1.1.1',
  20. 'HttpPort' => '80',
  21. 'HttpsPort' => '443',
  22. 'Weight' => '100'
  23. ]
  24. ]
  25. ]
  26. ]
  27. ],
  28. 'OriginProtocol' => 'HTTP'
  29. ];
  30. $response = $client->addCdnDomain($body);
  31. var_dump($response);