mirror of
https://github.com/fernwerker/ownDynDNS.git
synced 2025-07-09 21:55:13 +02:00
feat(update.php): Update of multiple domains with one call
Merge pull request #23 from theHaury/master Add possibility to update multiple domains with one update url
This commit is contained in:
commit
88fc9e90ae
2 changed files with 22 additions and 4 deletions
12
README.md
12
README.md
|
@ -22,9 +22,15 @@ Self-hosted dynamic DNS php script to update netcup DNS API from Router like AVM
|
|||
### AVM FRITZ!Box Settings
|
||||
* Go to "Internet" -> "Freigaben" -> "DynDNS"
|
||||
* Choose "Benutzerdefiniert"
|
||||
* Update-URL: `https://<url of your webspace>/update.php?user=<username>&password=<pass>&ipv4=<ipaddr>&ipv6=<ip6addr>&domain=<domain>`
|
||||
* only the url needs to be adjusted, the rest is automatically filled by your AVM FRITZ!Box
|
||||
* http or https is possible if valid SSL certificate (e.g. Let's Encrypt)
|
||||
* Single Domain:
|
||||
* Update-URL: `https://<url of your webspace>/update.php?user=<username>&password=<pass>&ipv4=<ipaddr>&ipv6=<ip6addr>&domain=<domain>`
|
||||
* only the url needs to be adjusted, the rest is automatically filled by your AVM FRITZ!Box
|
||||
* http or https is possible if valid SSL certificate (e.g. Let's Encrypt)
|
||||
* Multiple Domains
|
||||
* To Update Multiple domains, add every domain as a comma seperated list.
|
||||
* Update-URL: `https://<url of your webspace>/update.php?user=<username>&password=<pass>&ipv4=<ipaddr>&ipv6=<ip6addr>&domain=<domain1>,<domain2>,<domain3>....`
|
||||
* only the url needs to be adjusted, the rest is automatically filled by your AVM FRITZ!Box
|
||||
* http or https is possible if valid SSL certificate (e.g. Let's Encrypt)
|
||||
* Domainname: `<host record that is supposed to be updated>`
|
||||
* Username: `<username as defined in .env file>`
|
||||
* Password: `<password as definied in .env file>`
|
||||
|
|
14
update.php
14
update.php
|
@ -17,4 +17,16 @@ if (!file_exists('.env')) {
|
|||
|
||||
$config = parse_ini_file('.env', false, INI_SCANNER_TYPED);
|
||||
|
||||
(new netcup\DNS\API\Handler($config, $_REQUEST))->doRun();
|
||||
// Get the domains from the URL parameter and split them from the comma separated string
|
||||
$domains = explode(',', $_REQUEST['domain']);
|
||||
|
||||
// Loop through each domain and call the Handler
|
||||
foreach ($domains as $domain) {
|
||||
// Create a new request object with the current domain
|
||||
$request = $_REQUEST;
|
||||
$request['domain'] = trim($domain);
|
||||
|
||||
|
||||
// Call the Handler with the current domain
|
||||
(new netcup\DNS\API\Handler($config, $request))->doRun();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue