Dynamic domain name resolution using DNSPODAPI

Source: Internet
Author: User
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

  1. /**
  2. * @ Description: use DNSPOD to dynamically change the domain name direction,
  3. You can use a dial-up home computer or a WAN server.
  4. * @ Author: sang.williams@gmail.com
  5. * @ Time: 2013-8-6
  6. *
  7. * @ Todo:
  8. * 1. Added error prompts, such as logon errors.
  9. **/
  10. Header ("Content-type: text/html; charset = utf8 ");
  11. Require_once dirname (_ file _). '/lib/conf. php ';
  12. Require_once dirname (_ file _). '/lib/changeRecord. php ';
  13. Require_once dirname (_ file _). '/lib/getDomainID. php ';
  14. Require_once dirname (_ file _). '/lib/getRecordID. php ';
  15. Require_once dirname (_ file _). '/lib/getRemoteIP. php ';
  16. Require_once dirname (_ file _). '/lib/getRecordIP. php ';
  17. // Obtain the domain name ID
  18. $ Domain_id = getDomainID (DOMAIN );
  19. If (! $ Domain_id ){
  20. Echo "domain name is not added in DNSPOD. please add domain name in DNSPOD.
    \ N ";
  21. Exit ();
  22. }
  23. // Obtain the RECORD ID
  24. $ Record_id = getRecordID ($ domain_id, RECORD );
  25. If (! $ Record_id ){
  26. Echo "you have not created this record in DNSPOD. please go to DNSPOD to add the record first.
    \ N ";
  27. Exit ();
  28. }
  29. $ Record_ip = getRecordIP ($ domain_id, RECORD );
  30. // Echo 'the current record ID is '. $ record_id ."
    \ N ";
  31. Echo 'current record IP address is '. $ record_ip ."
    \ N ";
  32. // Obtain the current Wan IP address
  33. $ Ip = getRemoteIP ();
  34. Echo 'current Wan IP: '. $ ip ."
    \ N ";
  35. // 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.
  36. If ($ ip! = $ Record_ip ){
  37. Echo "change result
    \ N ". changeRecord ($ domain_id, $ record_id, $ ip, RECORD)." \ n ";
  38. } Else {
  39. Echo "nothing to do
    \ N ";
  40. }
  41. ?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.