Project

General

Profile

« Previous | Next » 

Revision 61c30081

Added by Jim Pingle almost 15 years ago

First try at a dyndns update type for Namecheap.com servers.

View differences:

etc/inc/dyndns.class
17 17
	 *    - StaticCling (staticcling.org)
18 18
	 *    - DNSexit (dnsexit.com)
19 19
	 *    - OpenDNS (opendns.com)
20
	 *    - Namecheap (namecheap.com)
20 21
	 * +----------------------------------------------------+
21 22
	 *  Requirements:
22 23
	 *    - PHP version 4.0.2 or higher with CURL Library
......
148 149
				case 'staticcling':
149 150
				case 'dnsexit':
150 151
				case 'opendns':
152
				case 'namecheap':
151 153
					$this->_update();	
152 154
					break;
153 155
				default:
......
416 418
					curl_close($ch);
417 419
					$this->_checkStatus($data);
418 420
					break;
421
				case 'namecheap':
422
					/* Example:
423
						https://dynamicdns.park-your-domain.com/update?host=[host_name]&domain=[domain.com]&password=[domain_password]&ip=[your_ip]
424
					*/
425
					$needsIP = FALSE;
426
					log_error("Namecheap: DNS update() starting.");
427
					curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
428
					list($hostname, $domain) = explode(".", $this->_dnsHost, 2);
429
					$server = "https://dynamicdns.park-your-domain.com/update?host={$hostname}&domain={$domain}&password={$this->_dnsPass}&ip={$this->_dnsIP}";
430
					curl_setopt($ch, CURLOPT_URL, $server);
431
					$data = curl_exec($ch);
432
					if (@curl_error($ch)) log_error("Curl error occurred: " . curl_error($ch));
433
					curl_close($ch);
434
					$this->_checkStatus($data);
419 435
				default:
420 436
					break;
421 437
			}
......
719 735
					        $this->_debug($data);
720 736
					}
721 737
					break;
738
				case 'namecheap':
739
					if (preg_match("/internal server error/i", $data)) {
740
						$status = "phpDynDNS: (Error) Server side error.";
741
					} else if (preg_match('/success/i', $data)) {
742
					        $status = "phpDynDNS: (Success) IP Address Updated Successfully!";
743
					        $successful_update = true;
744
					} else {
745
						$status = "phpDynDNS: (Unknown Response)";
746
						log_error("phpDynDNS: PAYLOAD: {$data}");
747
						$this->_debug($data);
748
					}
749
					break;
722 750
			}
723 751
			
724 752
			if($successful_update == true) {

Also available in: Unified diff