Home  >  Article  >  Backend Development  >  PHP calls Wanwang interface to implement domain name query function

PHP calls Wanwang interface to implement domain name query function

WBOY
WBOYOriginal
2016-07-25 09:10:191076browse
  • .com .cn .tel
    .mobi .net .org
    .asia .me .com.cn
    .net.cn .org.cn .gov.cn
    .hk .tv .biz
    .cc .name .info
    .公司 .网络 .中国
  • 复制代码

    php代码:

    1. //得到顶级域名
    2. $ext=$_POST['ext'];
    3. //得到二级域名
    4. $dns = $_POST['dns'];

    5. //print_r($ext);

    6. //$domain = $dns . "." . $ext[0];
    7. //echo $domain;

    8. //遍历所有的域名

    9. foreach ($ext as $value) {
    10. //组合域名
    11. $domain = $dns . "." . $value;

    12. //查询:

    13. echo $domain ;

    14. $do = "http://panda.www.net.cn/cgi-bin/check.cgi?area_domain=" . $domain;

    15. $xml_data = file_get_contents($do);
    16. $result_arr = (array) simplexml_load_string($xml_data);

    17. $returncode=$result_arr['returncode'];

    18. $key=$result_arr['key'];

    19. $original=$result_arr['original'];

    20. $status= substr($original,0,3);

    21. if($status=="210"){

    22. echo ":恭喜您,可以注册";
    23. }else if($status=="211"){
    24. echo ":已经注册";
    25. }else if($status=="212"){
    26. echo ":参数错误";
    27. }
    28. echo '
      ';
    29. }
    30. ?>

    复制代码


    Statement:
    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
    Previous article:Solutions to Undefined index and Undefined variable appearing in phpNext article:Solutions to Undefined index and Undefined variable appearing in php

    Related articles

    See more