This library is not related to the netcup GmbH, it is provided by a third party.
⚠️ Warning: This library is currently still WIP! Please use it only if you agree that the following releases contain breaking changes.
You can simply install this library using Composer by running composer require mrkriskrisu/netcup-api
. You'll need
PHP8.
$api = new \Netcup\API("apiKey", "apiPassword", "123456");
echo "Login " . ($api->isLoggedIn() ? 'successful! :)' : 'not successful! :c') . PHP_EOL;
$domain = $api->infoDomain('k118.de');
print_r($domain->getDnsRecords());
$domain = $api->infoDomain('k118.de');
$domain->createNewDnsRecord(new DnsRecord(
hostname: 'www',
type: 'A',
destination: '127.0.0.1'
));
$domain = $api->infoDomain('k118.de');
$record = $domain->getDnsRecords()[0];
$record->update(destination: '127.0.0.2');
$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
You can end the created session. This is optional. If you don't, the token will automatically expire after 15 minutes.
$logoutResult = $api->logout();