PHP中可读数据的数组
我得到的是谁的数据,所以有下面这样的代码PHP中可读数据的数组,php,mysql,arrays,Php,Mysql,Arrays,我得到的是谁的数据,所以有下面这样的代码 <?php error_reporting(0); header('Content-Type: text/html; charset=UTF-8'); $query = $_GET['query']; $fast = $_GET['fast']; include_once('whois.main.php'); include_once('whois.utils.php'); $whois = new Whois(); $result = $whoi
<?php
error_reporting(0);
header('Content-Type: text/html; charset=UTF-8');
$query = $_GET['query'];
$fast = $_GET['fast'];
include_once('whois.main.php');
include_once('whois.utils.php');
$whois = new Whois();
$result = $whois->Lookup($query);
?>
所以我创建了一个foreach循环,但它不工作,我的代码是
Domain Name: SRAPSWARE.COM
Registry Domain ID: 1628686810_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.publicdomainregistry.com
Registrar URL: www.publicdomainregistry.com
Updated Date: 2015-12-05T05:37:38Z
Creation Date: 2010-12-04T10:08:59Z
Registrar Registration Expiration Date: 2016-12-04T11:08:59Z
Registrar: PDR Ltd. d/b/a PublicDomainRegistry.com
Registrar IANA ID: 303
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Registry Registrant ID:
Registrant Name: Domain Admin
Registrant Organization: Privacy Protection Service INC d/b/a PrivacyProtect.org
Registrant Street: C/O ID#10760, PO Box 16 Note - Visit PrivacyProtect.org to contact the domain owner/operator Note - Visit PrivacyProtect.org to contact the domain owner/operator
Registrant City: Nobby Beach
Registrant State/Province: Queensland
Registrant Postal Code: QLD 4218
Registrant Country: AU
Registrant Phone: +45.36946676
Registrant Phone Ext:
Registrant Fax:
Registrant Fax Ext:
Registrant Email: contact@privacyprotect.org
Registry Admin ID:
Admin Name: Domain Admin
Admin Organization: Privacy Protection Service INC d/b/a PrivacyProtect.org
Admin Street: C/O ID#10760, PO Box 16 Note - Visit PrivacyProtect.org to contact the domain owner/operator Note - Visit PrivacyProtect.org to contact the domain owner/operator
Admin City: Nobby Beach
Admin State/Province: Queensland
Admin Postal Code: QLD 4218
Admin Country: AU
Admin Phone: +45.36946676
Admin Phone Ext:
Admin Fax:
Admin Fax Ext:
Admin Email: contact@privacyprotect.org
Registry Tech ID:
Tech Name: Domain Admin
Tech Organization: Privacy Protection Service INC d/b/a PrivacyProtect.org
Tech Street: C/O ID#10760, PO Box 16 Note - Visit PrivacyProtect.org to contact the domain owner/operator Note - Visit PrivacyProtect.org to contact the domain owner/operator
Tech City: Nobby Beach
Tech State/Province: Queensland
Tech Postal Code: QLD 4218
Tech Country: AU
Tech Phone: +45.36946676
Tech Phone Ext:
Tech Fax:
Tech Fax Ext:
Tech Email: contact@privacyprotect.org
Name Server: ns1.srapsware.com
Name Server: ns2.srapsware.com
DNSSEC:Unsigned
Registrar Abuse Contact Email: abuse-contact@publicdomainregistry.com
Registrar Abuse Contact Phone: +1-2013775952
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>>Last update of WHOIS database: 2015-12-09T06:41:04+0000Z<<<
For more information on Whois status codes, please visit https://icann.org/epp
Registration Service Provided By: RURALSERVER
PRIVACYPROTECT.ORG is providing privacy protection services to this domain name to
protect the owner from spam and phishing attacks. PrivacyProtect.org is not
responsible for any of the activities associated with this domain name. If you wish
to report any abuse concerning the usage of this domain name, you may do so at
http://privacyprotect.org/contact. We have a stringent abuse policy and any
complaint will be actioned within a short period of time.
The data in this whois database is provided to you for information purposes
only, that is, to assist you in obtaining information about or related to a
domain name registration record. We make this information available "as is",
and do 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) enable high volume, automated, electronic processes that stress or load
this whois database system providing you this information; or
(2) allow, enable, or otherwise support the transmission of mass unsolicited,
commercial advertising or solicitations via direct mail, electronic mail, or
by telephone.
The compilation, repackaging, dissemination or other use of this data is
expressly prohibited without prior written consent from us. The Registrar of
record is PDR Ltd. d/b/a PublicDomainRegistry.com.
We reserve the right to modify these terms at any time.
By submitting this query, you agree to abide by these terms.
但我需要它的格式
<?php
foreach ($result['rawdata'] as $key => $value) {
echo $value . '<br>';
/*
in $key are keys 0-77, in $value are strings
output:
'Domain Name: SRAPSWARE.COM'
'Registry Domain ID: '
...
*/
}
?>
因此,请帮助我获取$value格式的格式化数据['rawdata']是另一个数组,应该是
foreach ($result as $key => $value)
{
echo $value;
OR
echo $result[$key];
}
你必须用这个
<?php
if(!empty($result['rawdata']))
{
$winfo .= '<pre>'.implode($result['rawdata'],"\n").'</pre>';
}
else
{
$winfo = implode($whois->Query['errstr'],"\n<br></br>");
}
echo $winfo;
?>
您可以使用如下所示的结果数组- 请使用此选项,并让我们知道结果。另外,请刷新2-3次,因为所使用的库在一次尝试中未给出结果。如果你愿意,我可以给你另一个解决方案 你可以在这个url上查看这个 或者可以使用此url的其他解决方案
您的ob_start没有关闭ob_flush,可能这就是问题所在…我不明白您的意思,请发布整个阵列echo$value['rawdata'的输出是什么;在此之后,我的转储数据如下所示-不,这不是var_转储结果的样子。我也不知道你的需求和你的有什么不同。哦,你是说我们点击那个链接?!你为什么不把数据贴在这里?!不工作显示错误警告:在/home/hostingsp/public_html/whois/index2.php的第行为foreach提供的参数无效65@srapsware:对不起,rawdata与REGINFO处于同一级别-我是根据您的问题确定的。它必须是$result['rawdata',我已经更新了我的答案$result['regrinfo']是一个数组,$result['rawdata']是第二个数组。我不想要你确切需要的数据。你能发布打印结果吗?
<?php
foreach ($result['rawdata'] as $key => $value) {
echo $value . '<br>';
/*
in $key are keys 0-77, in $value are strings
output:
'Domain Name: SRAPSWARE.COM'
'Registry Domain ID: '
...
*/
}
?>
foreach ($result as $key => $value)
{
echo $value;
OR
echo $result[$key];
}
<?php
if(!empty($result['rawdata']))
{
$winfo .= '<pre>'.implode($result['rawdata'],"\n").'</pre>';
}
else
{
$winfo = implode($whois->Query['errstr'],"\n<br></br>");
}
echo $winfo;
?>