Dynamic domain name resolution using DNSPODAPI
Use dnspod api to implement dynamic domain name resolution and build servers at home
Direct access to dial-up computers using a domain name
- /**
- * @ Description: use DNSPOD to dynamically change the domain name direction,
- You can use a dial-up home computer or a WAN server.
- * @ Author: sang.williams@gmail.com
- * @ Time: 2013-8-6
- *
- * @ Todo:
- * 1. Added error prompts, such as logon errors.
- **/
- Header ("Content-type: text/html; charset = utf8 ");
- Require_once dirname (_ file _). '/lib/conf. php ';
- Require_once dirname (_ file _). '/lib/changeRecord. php ';
- Require_once dirname (_ file _). '/lib/getDomainID. php ';
- Require_once dirname (_ file _). '/lib/getRecordID. php ';
- Require_once dirname (_ file _). '/lib/getRemoteIP. php ';
- Require_once dirname (_ file _). '/lib/getRecordIP. php ';
- // Obtain the domain name ID
- $ Domain_id = getDomainID (DOMAIN );
- If (! $ Domain_id ){
- Echo "domain name is not added in DNSPOD. please add domain name in DNSPOD.
\ N ";
- Exit ();
- }
- // Obtain the RECORD ID
- $ Record_id = getRecordID ($ domain_id, RECORD );
- If (! $ Record_id ){
- Echo "you have not created this record in DNSPOD. please go to DNSPOD to add the record first.
\ N ";
- Exit ();
- }
- $ Record_ip = getRecordIP ($ domain_id, RECORD );
- // Echo 'the current record ID is '. $ record_id ."
\ N ";
- Echo 'current record IP address is '. $ record_ip ."
\ N ";
- // Obtain the current Wan IP address
- $ Ip = getRemoteIP ();
- Echo 'current Wan IP: '. $ ip ."
\ N ";
- // If the IP address of the current Wan is different from the IP address registered in DNSPOD, change it to the IP address of the current Wan.
- If ($ ip! = $ Record_ip ){
- Echo "change result
\ N ". changeRecord ($ domain_id, $ record_id, $ ip, RECORD)." \ n ";
- } Else {
- Echo "nothing to do
\ N ";
- }
- ?>
|