background image

php dns 解析类

分享一个

php 操作 dns 的类,可用于 dns 的查询、dns 解析等操作,有需要的朋友参考下。

php 实现的 dns 解析类,如下:

<?php
/* -----------

   PHPresolver - PHP DNS resolver library
                 Version 1.1
   This library is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published
   by the Free Software Foundation; either version 2.1 of the License, or any
   later version.

   This library is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
   License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this library; if not,
   write to the Free Software Foundation, Inc.,
   59 Temple Place, Suite 330, Boston, MA 02111-1307  USA

  ----------------------------------------------
*/

 define( "DNS_RECORDTYPE_A", 1 );
 define( "DNS_RECORDTYPE_NS", 2 );
 define( "DNS_RECORDTYPE_CNAME", 5 );
 define( "DNS_RECORDTYPE_SOA", 6 );
 define( "DNS_RECORDTYPE_PTR", 12 );
 define( "DNS_RECORDTYPE_MX", 15 );

 define( "DNS_RECORDTYPE_AAAA", 28 );

 define( "DNS_RECORDTYPE_ANY", 255 );
 
 define( "DNS_RECORDTYPE_TXT", 16 );

/*
 list of record types not yet implemented