Reputation: 33
I'm using a WHOIS script from github. it echo WHOIS array data output as JSON. I want output in a plain text. PHP script:
<?php
// ini_set('display_errors', 1);
// Load composer framework
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require(__DIR__ . '/vendor/autoload.php');
}
// use phpWhois\Whois;
// ini_set('display_errors', 1);
$whois = new Whois();
$query = $_GET["uri"];
$result = $whois->lookup($query,false);
echo json_encode($result);
?>
JSON Output:
{"regrinfo":{"domain":{"name":"techtimes.com","nserver":{"ns-1484.awsdns-57.org":"205.251.197.204","ns-1813.awsdns-34.co.uk":"205.251.199.21","ns-195.awsdns-24.com":"205.251.192.195","ns-525.awsdns-01.net":"205.251.194.13"},"status":["clientTransferProhibited https:\/\/icann.org\/epp#clientTransferProhibited"],"changed":"2015-09-15","created":"1999-12-12","expires":"2018-12-12"},"registered":"yes"},"regyinfo":{"registrar":"TLDS, LLC DBA SRSPLUS","referrer":"http:\/\/www.srsplus.com","servers":[{"server":"whois.verisign-grs.com","args":"techtimes.com","port":43},{"server":"whois.srsplus.com","args":"techtimes.com","port":43}],"type":"domain"},"rawdata":["Domain Name: techtimes.com\r","Registry Domain ID: 15114465_DOMAIN_COM-VRSN\r","Registrar WHOIS Server: whois.srsplus.com\r","Registrar URL: http:\/\/srsplus.com\r","Updated Date: 2015-09-15T20:15:00Z\r","Creation Date: 1999-12-12T16:00:16Z\r","Registrar Registration Expiration Date: 2018-12-12T16:00:16Z\r","Registrar: TLDS LLC. d\/b\/a SRSPlus\r","Registrar IANA ID: 320\r","Registrar Abuse Contact Email: [email protected]\r","Registrar Abuse Contact Phone: +1.8773812449\r","Reseller: \r","Domain Status: clientTransferProhibited http:\/\/icann.org\/epp#clientTransferProhibited\r","Registry Registrant ID:\r","Registrant Name: PERFECT PRIVACY, LLC\r","Registrant Organization:\r","Registrant Street: 12808 Gran Bay Pkwy West\r","Registrant City: Jacksonville\r","Registrant State\/Province: FL\r","Registrant Postal Code: 32258\r","Registrant Country: US\r","Registrant Phone: +1.9027492701\r","Registrant Phone Ext.:\r","Registrant Fax:\r","Registrant Fax Ext.:\r","Registrant Email: [email protected]\r","Registry Admin ID:\r","Admin Name: PERFECT PRIVACY, LLC\r","Admin Organization:\r","Admin Street: 12808 Gran Bay Pkwy West\r","Admin City: Jacksonville\r","Admin State\/Province: FL\r","Admin Postal Code: 32258\r","Admin Country: US\r","Admin Phone: +1.9027492701\r","Admin Phone Ext.:\r","Admin Fax:\r","Admin Fax Ext.:\r","Admin Email: [email protected]\r","Registry Tech ID:\r","Tech Name: PERFECT PRIVACY, LLC\r","Tech Organization:\r","Tech Street: 12808 Gran Bay Pkwy West\r","Tech City: Jacksonville\r","Tech State\/Province: FL\r","Tech Postal Code: 32258\r","Tech Country: US\r","Tech Phone: +1.9027492701\r","Tech Phone Ext.:\r","Tech Fax:\r","Tech Fax Ext.:\r","Tech Email: [email protected]\r","Name Server: ns-1484.awsdns-57.org","Name Server: ns-525.awsdns-01.net","Name Server: ns-195.awsdns-24.com","Name Server: ns-1813.awsdns-34.co.uk\r","DNSSEC: Unsigned\r","URL of the ICANN WHOIS Data Problem Reporting System: http:\/\/wdprs.internic.net\/ \r",">>> Last update of WHOIS database: 2015-09-15T20:15:00Z <<<\r","\r","For more information on Whois status codes, please visit https:\/\/www.icann.org\/resources\/pages\/epp-status-codes-2014-06-16-en.\r","\r","The data in SRSPlus's WHOIS database is provided to you by\r","SRSPlus for information purposes only, that is, to assist you in\r","obtaining information about or related to a domain name registration\r","record. SRSPlus makes this information available \"as is,\" and\r","does not guarantee its accuracy. By submitting a WHOIS query, you\r","agree that you will use this data only for lawful purposes and that,\r","under no circumstances will you use this data to: (1) allow, enable,\r","or otherwise support the transmission of mass unsolicited, commercial\r","advertising or solicitations via direct mail, electronic mail, or by\r","telephone; or (2) enable high volume, automated, electronic processes\r","that apply to SRSPlus (or its systems). The compilation,\r","repackaging, dissemination or other use of this data is expressly\r","prohibited without the prior written consent of SRSPlus.\r","SRSPlus reserves the right to modify these terms at any time.\r","By submitting this query, you agree to abide by these terms.\r"]}
I want output as a plain text. I use echo implode("<br>",$result);
but it give output
Array
Array
Array
Upvotes: 0
Views: 667
Reputation: 392
$whois = new Whois();
$query = 'example.com';
$result = $whois->lookup($query,false);
echo "<pre>";
print_r($result);
echo "</pre>";
its ok!
Upvotes: 1