php whois查询API制作方法

这里我们从万网或新网的数据接口取得数据,透过php的简单文本处理再输出。
复制代码 代码如下:

<php?
$domain = $_GET['q'];
preg_match("
<div class="\"lyTableInfoWrap\"">(.+?)</div>
is", @file_get_contents('http://www.xinnet.cn/Modules/agent/serv/pages/domain_whois.jsp?domainNameWhois='.$domain.'&noCode=noCode'), $whois);
echo $whois[1];
?>

做到这里,可能有的朋友要问了,这不就是简单的php脚本么?!哪是api接口阿;接着我们来加工一下,让查询方式更专业一些:
我们需要的查询格式如下:
http://api/whois/baidu.com
其中baidu.com是需要查询的域名
可以修改nginx的配置来实现这一点:
复制代码 代码如下:

location ~* /whois/(.+)$ {
proxy_pass http://127.0.0.1:8080/whois/index.php?q=baidu.com
#将查询传递给内网的apache处理
}

ok,至此一个使用的whois api接口完成了,你可以自己的程序中调用,也可以共享给大家使用^_^!。
查询baidu.com的结果:
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: BAIDU.COM
Registrar: REGISTER.COM, INC.
Whois Server: whois.register.com
Referral URL: http://www.register.com
Name Server: DNS.BAIDU.COM
Name Server: NS2.BAIDU.COM
Name Server: NS3.BAIDU.COM
Name Server: NS4.BAIDU.COM
Status: clientTransferProhibited
Status: serverDeleteProhibited
Status: serverTransferProhibited
Status: serverUpdateProhibited
Updated Date: 15-mar-2010
Creation Date: 11-oct-1999
Expiration Date: 11-oct-2014
>>> Last update of whois database: Fri, 20 Aug 2010 05:42:12 UTC <<<
NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar. Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.
TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' (“VeriSign”) Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability. VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.
The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.
The data in Register.com's WHOIS database is provided to you by
Register.com for information purposes only, that is, to assist you in
obtaining information about or related to a domain name registration
record. Register.com makes this information available “as is,” and
does not guarantee its accuracy. By submitting a WHOIS query, you
agree that you will use this data only for lawful purposes and that,
under no circumstances will you use this data to: (1) allow, enable,
or otherwise support the transmission of mass unsolicited, commercial
advertising or solicitations via direct mail, electronic mail, or by
telephone; or (2) enable high volume, automated, electronic processes
that apply to Register.com (or its systems). The compilation,
repackaging, dissemination or other use of this data is expressly
prohibited without the prior written consent of Register.com.
Register.com reserves the right to modify these terms at any time.
By submitting this query, you agree to abide by these terms.
Registrant:
Beijing Baidu Netcom Science and Technology Co.Ltd.
Baidu Netcom Baidu Netcom
No. 10, Shangdi 10th Street, Haidian District,
Beijing, 100085
CN
Phone: +86.1059926680
Email: domainmaster@baidu.com
Registrar Name….: Register.com
Registrar Whois…: whois.register.com
Registrar Homepage: www.register.com
Domain Name: baidu.com
Created on…………..: 1999-10-11
Expires on…………..: 2014-10-11
Administrative Contact:
Beijing Baidu Netcom Science and Technology Co.Ltd.
Baidu Netcom Baidu Netcom
No. 10, Shangdi 10th Street, Haidian District,
Beijing, 100085
CN
Phone: +86.1059927440
Email: wumengyi@baidu.com
Technical Contact:
Registercom
Domain Registrar
575 8th Avenue
New York, NY 10018
US
Phone: +1.9027492701
Email: domainregistrar@register.com
DNS Servers:
ns3.baidu.com
ns2.baidu.com
ns4.baidu.com
dns.baidu.com
Visit AboutUs.org for more information about baidu.com
AboutUs: baidu.com
Register your domain name at http://www.register.com

时间: 2024-09-17 04:11:15

php whois查询API制作方法的相关文章

php whois查询API制作方法_php技巧

这里我们从万网或新网的数据接口取得数据,透过php的简单文本处理再输出. 复制代码 代码如下: <php? $domain = $_GET['q']; preg_match("| <div class="\"lyTableInfoWrap\"">(.+?)</div> |is", @file_get_contents('http://www.xinnet.cn/Modules/agent/serv/pages/dom

用PHP实现标准的IP Whois查询

由于Internet的历史原因,apin负责整个网络IP的整体规划以及北美区 还有部分非洲地区的IP分配管理,与此相应的是,whois.apin.net是IP whois的root server,标准的IP whois查询方法是,首先向whois.apin.net查询某个IP属于哪个大区,然后再向该区的whois 服务器查询此IP的whois详细信息.      目前负责 IPV4的大区       whois.arin.net 美洲区 北美       whois.apnic.net 亚太区

翻译jquery官方的插件制作方法

有时候你想重复使用同一个代码块,举例:你想写一方法,你可以用这个方法,选择做一系列的选择操作,所以你想创造一个插件. jquery怎么样工作:jquery对象方法(jquery Object Methods) 在写自己的插件之前,我们必须明白下面这段代码是如何工作的: $( "a" ).css( "color", "red" );  这是一段简洁实用的jquery代码段,但是你知道jquery幕后是如何工作的么?当你只用 "$"

Laravel使用Caching缓存数据减轻数据库查询压力的方法_php实例

本文实例讲述了Laravel使用Caching缓存数据减轻数据库查询压力的方法.分享给大家供大家参考,具体如下: 昨天想把自己博客的首页做一下缓存,达到类似于生成静态页缓存的效果,在群里问了大家怎么做缓存,都挺忙的没多少回复,我就自己去看了看文档,发现了Caching这个部分,其实之前也有印象,但是没具体接触过,顾名思义,就是缓存了,那肯定和我的需求有点联系,我就认真看了看,发现的确是太强大了,经过很简单的几个步骤,我就改装好了首页,用firebug测试了一下,提高了几十毫秒解析时间,当然了有人

Java8中使用流方式查询数据库的方法_java

由于关系型数据库操作语言和面向对象语言之间的差异,如今我们仍然需要花费许多时间建立数据库与 Java 应用之间互相沟通的桥梁.通常,我们可以编写自己的映射层(mapping layer),或者使用第三方的 ORM(Object Relational Mapper)对象关系映射框架,比如 Hibernate.ORM 框架虽然使用起来很方便,但是如何正确地配置和提高框架操作数据库的性能却不太容易,ORM 框架往往会使我们的应用性能下降. 最近,我贡献了一个新的开源项目--Speedment,它能使我

《Nmap渗透测试指南》—第7章7.3节WHOIS查询

7.3 WHOIS查询表7.3所示为本章节所需Nmap命令表,表中加粗命令为本小节所需命令--WHOIS查询. WHOIS(读作"Who is",而非缩写)是用来查询互联网中域名的IP以及所有者等信息的传输协议.早期的WHOIS查询多以命令行接口(Command Line)存在,但是现在出现了一些基于网页接口的简化在线查询工具,甚至可以一次向不同的数据库查询.网页接口的查询工具仍然依赖WHOIS协议向服务器发送查询请求,命令行接口的工具仍然被系统管理员广泛使用. WHOIS通常使用TC

利用AJAX进行whois查询

ajax说新颖也不新颖的一项技术,如果你用过google map服务就会体会到他的优点,当然不能乱用,呵呵!    下面是自己写的一个小例子,仅供参考,见笑!    是调用7e的whois查询 详细内容可去网上搜索~    具体代码如下:  main.html内容  <html>    <HEAD>    <title>利用AJAX调用whois查询</title>    <meta http-equiv="Content-Type"

用PHP实现标准的IP Whois查询_php基础

      由于Internet的历史原因,apin负责整个网络IP的整体规划以及北美区 还有部分非洲地区的IP分配管理,与此相应的是,whois.apin.net是IP whois的root server,标准的IP whois查询方法是,首先向whois.apin.net查询某个IP属于哪个大区,然后再向该区的whois 服务器查询此IP的whois详细信息.       目前负责 IPV4的大区       whois.arin.net 美洲区 北美       whois.apnic.n

iOS/Android/WAP 全兼容专题页面制作方法(一)

READ First:这是供编辑人员所读的文档.关于技术上如何实 iOS/Android/WAP 的方法,稍后释出. 专题页面制作方法 概述 专题页面采用 HTML 脚本进行定义,以满足各种界面排版的需求.HTML 页面采用静态方式保存.客户端及 WAP 浏览器皆能正常展示该页面,并能正常响点击事件并跳转到内容显示界面,客户端跳转到响应的原生内容界面.WAP 门户跳转到相应的 WAP 内容展示页.相关预备知识: 了解基本 HTML  语法,了解 FTP  操作: 熟悉 PMS 后台系统录入数据.