PHP calls Wanwang interface to implement domain name query function

WBOY
Release: 2016-07-25 09:10:19
Original
1055 people have browsed it
  • .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. ?>

    复制代码


    source:php.cn
    Previous article:Solutions to Undefined index and Undefined variable appearing in php Next article:Example of php singleton pattern
    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
    Latest Issues
    Related Topics
    More>
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!