本示例通过Alibaba Cloud SDK for PHP,完成添加解析记录(AddDomainRecord)的任务。
use AlibabaCloud\Client\AlibabaCloud; use AlibabaCloud\Client\Exception\ClientException; use AlibabaCloud\Client\Exception\ServerException;
// Download:https://github.com/aliyun/openapi-sdk-php // Usage:https://github.com/aliyun/openapi-sdk-php/blob/master/README.md
AlibabaCloud::accessKeyClient(' ', ' ') ->regionId('cn-hangzhou') // replace regionId as you need ->asDefaultClient();
try { $result = AlibabaCloud::rpc() ->product('Alidns') // ->scheme('https') // https | http ->version('2015-01-09') ->action('AddDomainRecord') ->method('POST') ->options([ 'query' => [ 'DomainName' => "dns-example.com", 'RR' => "apitest1", 'Type' => "A", 'Value' => "3.0.3.0", ], ]) ->request(); print_r($result->toArray()); } catch (ClientException $e) { echo $e->getErrorMessage() . PHP_EOL; } catch (ServerException $e) { echo $e->getErrorMessage() . PHP_EOL; }
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。