Skip to content

Commit

Permalink
Added example script for updating your dynamic ip.
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperhartwich committed Feb 9, 2012
1 parent b8fff5b commit 2d5ebb8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
@@ -1,9 +1,9 @@
php-gratisdns
==

You can use this to alter your DNS entries at GratisDNS.
You can use this to alter your DNS entries at GratisDNS. cURL required.

See `example.php` for how to use this. cURL required.
See `example.php` for how to use this and use `dyndns.php` to automatically update a record with a dynamic ip.

Feel free to fork.

Expand Down
18 changes: 18 additions & 0 deletions dyndns.php
@@ -0,0 +1,18 @@
<?php
/**
* For updating a record with your dynamic ip.
* Run with command: php -f dyndns.php
*/
include('lib/gratisdns.php');

$username = 'your-login';
$password = 'your-password';

$domain = 'test123.dk';
$host = 'home.test123.dk';

$ip = file_get_contents('http://whatismyip.org/');

$dns = new GratisDNS($username, $password);
$record = $dns->getRecordByDomain($domain, 'A', $host);
$dns->updateRecord($domain, $record['recordid'], 'A', $host, $ip, 4800);

0 comments on commit 2d5ebb8

Please sign in to comment.