Tutorial on developing an international domain name query system using PHP + AJAX

Source: Internet
Author: User
Tags domain name registration
Many webmasters sell domain names part-time and earn a small amount of money. do not despise them. they all want to query domain names on their websites to see if they can be purchased or sold, now let's talk about how to use PHP + AJAX to implement an international domain name query system. PHP + AJAX domain name query preparation... many webmasters sell domain names part-time and earn a small amount of money. do not despise them. they all want to query domain names on their websites to see if they can be purchased or sold, now let's talk about how to use PHP + AJAX to implement an international domain name query system.

PHP + AJAX domain name query preparation

This query system uses the Ajax functions of PHP and JQUery to query domain name information. here we mainly query whether the domain name has been registered. the system mainly uses the domain name query API interface provided by HiChina, related knowledge points are listed as follows:

JQUery Ajax implementation: for details about this part, refer to the JQuery API documentation or the upcoming JQUery tutorial on this site.

File_get_contents function: reads the entire file into a string, which is used to read a webpage. The HiChina API returns the result page.

Simplexml_load_string function: used to parse an xml document to an object.

Strrpos function: used to locate the first occurrence of a string. it is used to search for keywords.

Domain name query system requirement analysis

Query whether the domain name has been registered based on the domain name entered by the user.

Domain name registration information (whois) query, this function is not implemented in this tutorial, you can refer to the existing functions to achieve.

Page/file information

Domain.html: form submission and query result display page.

Domain_check.php: PHP file for processing domain name information query.

HiChina domain name query API

The interface uses HTTP, POST, and GET protocols.

Call URL: http://panda.www.net.cn/cgi-bin/check.cgi

Parameter name: the value of area_domain is a standard domain name, for example, 5idev.com.

Call example: http://panda.www.net.cn/cgi-bin/check.cgi? Area_domain = 5idev.com

The returned XML code is as follows:

  
 
  200
  
 
  5idev.com
  
 
  211 : Domain name is not available
  

XML results:

Returncod: API call status.

Key: The domain name of the current check.

Original: results of domain name check.

Original has four results:

210: Domain name is available: indicates that the Domain name can be registered

211: Domain name is not available: indicates that the Domain name has been registered

212: Domain name is invalid: indicates Domain name parameter transmission error

214: Unknown error or query exception

Domain.html key code

The domain.html page displays the form Ajax submission and domain name query result information. the complete code is as follows. Note that it is UTF-8 encoded:

   Domain Name Registration Query 
  

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.