Skip to content

Instantly share code, notes, and snippets.

@beat
beat / ddns-api.php
Last active January 1, 2023 10:41 — forked from fredsted/ddns-api.php
Virtualmin Dynamic DNS (DDNS) server
<?php
// This script receives DDNS updates via HTTP and stores them into a JSON file for another script.
// example: http://server/ddns-api.php?code=DDNS_CODE&hostname=home = updates home.domain.com to IP of requester
// example: http://server/ddns-api.php?code=DDNS_CODE&hostname=home&myip=1.2.3.4 = updates home.domain.com to IP 1.2.3.4
// example: http://server/ddns-api.php?code=DDNS_CODE&hostname=home&myip6=1:2:3::4 = updates home.domain.com to IPv6
// example: http://server/ddns-api.php?code=DDNS_CODE&hostname=home&myip=1.2.3.4&myip6=1:2:3::4 = updates home.domain.com to IPv4 and IPv6 given
// example: http://server/ddns-api.php?code=DDNS_CODE&hostname=home&action=delete = deletes home.domain.com from DNS
define('DDNS_DATA_FILE', '/home/ddns/ddns.json');