From 61c30081675657a9eb76b309cde2b75eeb5d5511 Mon Sep 17 00:00:00 2001 From: jim-p Date: Mon, 30 Aug 2010 23:40:17 -0400 Subject: First try at a dyndns update type for Namecheap.com servers. --- etc/inc/dyndns.class | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'etc') diff --git a/etc/inc/dyndns.class b/etc/inc/dyndns.class index 2e90386..0168d3e 100644 --- a/etc/inc/dyndns.class +++ b/etc/inc/dyndns.class @@ -17,6 +17,7 @@ * - StaticCling (staticcling.org) * - DNSexit (dnsexit.com) * - OpenDNS (opendns.com) + * - Namecheap (namecheap.com) * +----------------------------------------------------+ * Requirements: * - PHP version 4.0.2 or higher with CURL Library @@ -148,6 +149,7 @@ case 'staticcling': case 'dnsexit': case 'opendns': + case 'namecheap': $this->_update(); break; default: @@ -416,6 +418,20 @@ curl_close($ch); $this->_checkStatus($data); break; + case 'namecheap': + /* Example: + https://dynamicdns.park-your-domain.com/update?host=[host_name]&domain=[domain.com]&password=[domain_password]&ip=[your_ip] + */ + $needsIP = FALSE; + log_error("Namecheap: DNS update() starting."); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + list($hostname, $domain) = explode(".", $this->_dnsHost, 2); + $server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$this->_dnsPass}&ip={$this->_dnsIP}"; + curl_setopt($ch, CURLOPT_URL, $server); + $data = curl_exec($ch); + if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch)); + curl_close($ch); + $this->_checkStatus($data); default: break; } @@ -719,6 +735,18 @@ $this->_debug($data); } break; + case 'namecheap': + if (preg_match("/internal server error/i", $data)) { + $status = "phpDynDNS: (Error) Server side error."; + } else if (preg_match('/success/i', $data)) { + $status = "phpDynDNS: (Success) IP Address Updated Successfully!"; + $successful_update = true; + } else { + $status = "phpDynDNS: (Unknown Response)"; + log_error("phpDynDNS: PAYLOAD: {$data}"); + $this->_debug($data); + } + break; } if($successful_update == true) { -- cgit v1.1