Dynamic resolution of domain names using the Dnspod API

Source: Internet
Author: User
Use the Dnspod API for domain name dynamic parsing, building servers at home

Direct access to dial-up Internet pcs using domain name
  1. /**
  2. * @description: Realize the use of dnspod dynamic change the domain name point,
  3. Can realize the home dial-up Internet PC can also be used as a WAN server
  4. * @author: sang.williams@gmail.com
  5. * @time: 2013-8-6
  6. *
  7. * @todo:
  8. * 1. Add error prompts, such as login 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. Get domain ID
  18. $domain _id = getdomainid (domain);
  19. if (! $domain _id) {
  20. echo "Domain name not added in Dnspod, please add domain name in dnspod.
    \ n ";
  21. Exit ();
  22. }
  23. Get record ID
  24. $record _id= Getrecordid ($domain _id, record);
  25. if (! $record _id) {
  26. echo "You have not currently established this record in dnspod, please go to Dnspod to add a record
    \ n ";
  27. Exit ();
  28. }
  29. $record _ip = Getrecordip ($domain _id, record);
  30. Echo ' current record ID is '. $record _id.
    \ n ";
  31. Echo ' current record IP is '. $record _ip.
    \ n ";
  32. Get the current WAN IP address
  33. $ip = Getremoteip ();
  34. Echo ' Current WAN IP is: '. $ip. "
    \ n ";
  35. If the current WAN IP is not the same as the Dnspod registered IP, it is modified to the current WAN IP
  36. if ($ip! = $record _ip) {
  37. echo "Change results
    \ n ". Changerecord ($domain _id, $record _id, $ip, record)." \ n ";
  38. }else{
  39. echo "Nothing to do
    \ n ";
  40. }
  41. ?>
Copy Code
  • 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.