mrkriskrisu / netcup-api
用于与netcup CCP和DNS API通信的库
v0.0.6
2024-05-09 12:16 UTC
Requires
- php: ^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.2
README
此库与netcup GmbH无关,由第三方提供。
⚠️ 警告:此库目前仍处于开发中! 仅当您同意以下版本包含破坏性更改时才使用它。
安装
您可以通过运行 composer require mrkriskrisu/netcup-api
使用Composer安装此库。您需要PHP8。
示例
登录API
$api = new \Netcup\API("apiKey", "apiPassword", "123456"); echo "Login " . ($api->isLoggedIn() ? 'successful! :)' : 'not successful! :c') . PHP_EOL;
域名
获取域名和DNS记录
$domain = $api->infoDomain('k118.de'); print_r($domain->getDnsRecords());
创建新的DNS记录
$domain = $api->infoDomain('k118.de'); $domain->createNewDnsRecord(new DnsRecord( hostname: 'www', type: 'A', destination: '127.0.0.1' ));
更新现有的DNS记录
$domain = $api->infoDomain('k118.de'); $record = $domain->getDnsRecords()[0]; $record->update(destination: '127.0.0.2');
删除DNS记录
$domain = $api->infoDomain('k118.de'); $record = $domain->getDnsRecords()[0]; $record->delete();
域名处理(仅限经销商)
创建和更新处理
$handle = $api->createHandle( name: 'Edward Keir', street: 'Street of God 1', postalCode: '12345', city: 'Examplecity', countryCode: 'DE', telephone: '+49.123456789', email: 'example@k118.de' ); $handle->setCity('Kassel'); //this will directly edit the data at the netcup database as well
登出
您可以结束创建的会话。这是可选的。如果您不这么做,令牌将在15分钟后自动过期。
$logoutResult = $api->logout();