Script in PHP to update DNS type A records on porkbun.com using their API
Go to file
Ramon Caballero 448eebd1d6 Centralize error handling inside UpdateDnsCommand 2026-04-07 00:13:10 +01:00
bin Add unit tests 2026-04-07 00:07:52 +01:00
config Refactor existing code into classes 2026-04-06 22:52:51 +01:00
src Centralize error handling inside UpdateDnsCommand 2026-04-07 00:13:10 +01:00
tests Add unit tests 2026-04-07 00:07:52 +01:00
.gitignore Add unit tests 2026-04-07 00:07:52 +01:00
README.md Enhance README.md 2024-07-31 10:52:47 +01:00
composer.json Add unit tests 2026-04-07 00:07:52 +01:00
composer.lock Add unit tests 2026-04-07 00:07:52 +01:00
phpunit.xml Add unit tests 2026-04-07 00:07:52 +01:00

README.md

pb-dydns

Script in PHP to update DNS type A records on porkbun.com using their API.

This can easily be modified to a different programming or scripting language and domain registrar.

Prerequisites

  • At least one domain in porkbun.com with DNS type A records already pointing to your dynamic IP address.
  • Access to Porkbun API.

How to use it

from command line

$ php /path/to/pb-dydns.php domain_name

as a cron job

$ crontab -e

Modify this line to fit your needs, and add it as many times as domains you want to automatically update:

*/10 * * * *    php /path/to/pb-dydns.php domain_name > /dev/null

That will run the script every 10 minutes.

Then restart cron (I'm not sure if this is necessary):

$ sudo systemctl restart cron

Entries to pb-dydns.log will be added, to view it you can:

$ cat /path/to/pb-dydns.log