Skip to content

Instantly share code, notes, and snippets.

@corny
Created August 14, 2014 07:05
Show Gist options
  • Save corny/102b216c2a8d0dd81242 to your computer and use it in GitHub Desktop.
Save corny/102b216c2a8d0dd81242 to your computer and use it in GitHub Desktop.
Update no-ip.com und tunnelbroker simultaneously (dyndns)
<?php
# Update no-ip.com und tunnelbroker simultaneously (dyndns)
error_reporting(E_ALL);
$key = "secret-key";
$addr = isset($_GET['addr']) ? $_GET['addr'] : $_SERVER['REMOTE_ADDR'];
if($_GET['key'] != $key){
header("Status: 401 Unauthorized");
die ("Not authorized");
}
if(strpos($addr, ".") === false){
header("Status: 422 Unprocessable Entity");
die ("Invalid IPv4 address");
}
header("Content-Type:text/plain");
if(file_get_contents("current_address") == $addr)
die("address unchanged");
echo "Updating no-ip ... ";
echo file_get_contents("https://user:password@dynupdate.no-ip.com/nic/update?hostname=myhost&myip=$addr");
echo "\n";
echo "Updating tunnelbroker ... ";
echo file_get_contents("https://user:password@ipv4.tunnelbroker.net/ipv4_end.php?ip=$addr&tid=1234");
file_put_contents("current_address", $addr);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment