Using DNSPOD API to implement dynamic domain name resolution
Release: 2016-07-25 08:50:16
Original
1525 people have browsed it
Use DNSPOD API to achieve dynamic resolution of domain names and build servers at home
Use domain names to directly access dial-up computers
- /**
- * @description: Use DNSPOD to dynamically change domain name pointing,
- can realize home dial-up Internet access and the computer can also be used as a WAN server
- * @author: sang.williams@gmail.com
- * @time: 2013-8-6
- *
- * @todo :
- * 1. Add error prompts, such as login errors, etc.
- **/
- 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';
- //Get the domain name ID
- $domain_id = getDomainID(DOMAIN);
- if (!$domain_id) {
- echo "The domain name has not been added in DNSPOD, please add the domain name in DNSPOD.
n";
- exit();
- }
-
- //Get RECORD ID
- $record_id= getRecordID ($domain_id, RECORD);
- if (!$record_id) {
- echo "You have not yet created this record in DNSPOD. Please go to DNSPOD to add a record first
n";
- exit();
- }
-
- $record_ip = getRecordIP($domain_id, RECORD);
-
- //echo 'The current record ID is'.$record_id."
n";
- echo 'The current record IP is'.$record_ip."< br>n";
-
- //Get the current WAN IP address
- $ip = getRemoteIP();
-
- echo 'The current WAN IP is:'.$ip."
n";
-
- //If If the current WAN IP and DNSPOD registered IP are different, change it to the current WAN IP
- if ($ip != $record_ip) {
- echo "Change result
n".changeRecord( $domain_id, $record_id, $ip, RECORD)."n";
- }else{
- echo "nothing to do
n";
- }
-
- ?>
Copy code
|
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31