ownDynDNS - Self-hosted dynamic DNS php script for Speedport Smart 4 and netcup DNS API

git clone git://git.bcharge.de/ownDynDNS.git

About | Log | Files | Refs | License

commit 88fc9e90aece7219bbb404ed2ad271f5d4b26139
parent 1eb144d800d7d72d3e8f7b98d67faedb38506207
Author: Felix Kretschmer <5871630+fernwerker@users.noreply.github.com>
Date:   Fri, 12 May 2023 21:14:37 +0200

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
Diffstat:
MREADME.md | 12+++++++++---
Mupdate.php | 14+++++++++++++-
2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/README.md b/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>` diff --git a/update.php b/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(); +}