精灵巫婆 发表于 2015-2-3 23:37:26

PHP网站制作之php whois查询API制造办法

第1步环境配置好了,你算了进了1小步了,那么第2步呢 就是调出第1个程序 一般都是用hello world,视频教程里面我都做了,hello world   这里咱们从万网或新网的数据接口获得数据,透过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;
?>

做到这里,能够有的伴侣要问了,这不就是复杂的php剧本么?!哪是api接口阿;接着咱们来加工一下,让查询体例更专业一些:
咱们需求的查询格局以下:
http://api/whois/百度.com
个中百度.com是需求查询的域名
可以修正nginx的设置装备摆设来完成这一点:
复制代码 代码以下:
location ~* /whois/(.+)$ {
proxy_pass http://127.0.0.1:8080/whois/index.php?q=百度.com
#将查询传递给内网的apache处置
}

ok,至此一个利用的whois api接口完成了,你可以本人的法式中挪用,也能够同享给人人利用^_^!。
查询百度.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@百度.com
Registrar Name….: Register.com
Registrar Whois…: whois.register.com
Registrar Homepage: www.register.com
Domain Name: 百度.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@百度.com
Technical Contact:
Registercom
Domain Registrar
575 8th Avenue
New York, NY 10018
US
Phone: +1.9027492701
Email: domainregistrar@register.com
DNS Servers:
ns3.百度.com
ns2.百度.com
ns4.百度.com
dns.百度.com
Visit AboutUs.org for more information about 百度.com
AboutUs: 百度.com
Register your domain name at http://www.register.com讲了这么多,无非是想说:学习PHP不仅要掌握方法,更多的是付出汗水,我不希望看到中途放弃的人,相信自己,相信自己的选择,更要相信自己的能力,如果自己想放弃,暴力一点的话,就自己抽自己一个嘴巴。

因胸联盟 发表于 2015-2-4 03:52:45

基础有没有对学习php没有太大区别,关键是兴趣。

不帅 发表于 2015-2-8 20:46:18

其实也不算什么什么心得,在各位大侠算是小巫见大巫了吧,望大家不要见笑,若其中有错误的地方请各位大虾斧正。

爱飞 发表于 2015-2-13 04:55:13

先学习php和mysql,还有css(html语言很简单)我认为现在的效果比以前的方法好。

愤怒的大鸟 发表于 2015-2-25 21:49:33

学习php的目的往往是为了开发动态网站,phper就业的要求也涵盖了很多。我大致总结为:精通php和mysql

admin 发表于 2015-3-8 06:12:06

建议加几个专业的phper的群,当然啦需要说话的人多,一处一点问题能有人回答你的,当然啦要让人回答你的问题,平时就得躲在里面聊天,大家混熟啦,愿意回答你问题的人自然就多啦。

分手快乐 发表于 2015-3-11 11:49:16

首推的搜索引擎当然是Google大神,其次我比较喜欢 百度知道。不过搜出来的结果往往都是 大家copy来copy去的,运气的的概率很大。

透明 发表于 2015-3-17 01:09:16

如果你可以写完像留言板这样的程序,那么你可以去一些别人的代码了,

兰色精灵 发表于 2015-3-20 01:57:53

本文当是我的笔记啦,遇到的问题随时填充

再见西城 发表于 2015-4-1 17:12:24

当留言板完成的时候,下步可以把做1个单人的blog程序,做为目标,

飘灵儿 发表于 2015-4-6 13:02:12

我要在声明一下:我是个菜鸟!!我对php这门优秀的语言也是知之甚少。但是我要在这里说一下php在网站开发中最常用的几个功能:

蒙在股里 发表于 2015-4-16 03:08:49

写的比较杂,因为我也是个新手,不当至于大家多多指正。

莫相离 发表于 2015-4-16 07:09:28

我要在声明一下:我是个菜鸟!!我对php这门优秀的语言也是知之甚少。但是我要在这里说一下php在网站开发中最常用的几个功能:

小魔女 发表于 2015-4-21 10:30:06

当留言板完成的时候,下步可以把做1个单人的blog程序,做为目标,

乐观 发表于 2015-4-25 07:31:55

说php的话,首先得提一下数组,开始的时候我是最烦数组的,总是被弄的晕头转向,不过后来呢,我觉得数组里php里最强大的存储方法,所以建议新手们要学好数组。

海妖 发表于 2015-4-27 23:37:54

有时候汉字的空格也能导致页面出错,所以在写代码的时候,要输入空格最好用引文模式。

谁可相欹 发表于 2015-4-28 15:18:08

在我安装pear包的时候老是提示,缺少某某文件,才发现 那群extension 的排列是应该有一点的顺序,而我安装的版本的排序不是正常的排序。没办法我只好把那群冒号加了上去,只留下我需要使用的扩展。

金色的骷髅 发表于 2015-5-6 02:11:16

我要在声明一下:我是个菜鸟!!我对php这门优秀的语言也是知之甚少。但是我要在这里说一下php在网站开发中最常用的几个功能:

简单生活 发表于 2015-6-12 05:32:40

先学习php和mysql,还有css(html语言很简单)我认为现在的效果比以前的方法好。
页: [1]
查看完整版本: PHP网站制作之php whois查询API制造办法