File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,8 +29,19 @@ https.get(url, function (res) {
2929 } ) ;
3030 res . on ( 'end' , function ( ) {
3131 try {
32- var parsedData = JSON . stringify ( rawData ) ;
33- console . log ( parsedData ) ;
32+ var parsedData = JSON . parse ( rawData ) ;
33+ if ( parsedData . WhoisRecord ) {
34+ console . log (
35+ 'Domain name: '
36+ + parsedData . WhoisRecord . domainName
37+ ) ;
38+ console . log (
39+ 'Contact email: '
40+ + parsedData . WhoisRecord . contactEmail
41+ ) ;
42+ } else {
43+ console . log ( parsedData ) ;
44+ }
3445 } catch ( e ) {
3546 console . log ( e . message ) ;
3647 }
Original file line number Diff line number Diff line change 1+ $uri = " https://www.whoisxmlapi.com/whoisserver/" `
2+ + " WhoisService?domainName=google.com" `
3+ + " &username=xxxx&password=xxxxxxx" `
4+ + " &outputFormat=json"
5+
6+ $j = Invoke-WebRequest - Uri $uri - UseBasicParsing | `
7+ ConvertFrom-Json
8+
9+ if ([bool ]($j.PSObject.Properties.name -match " WhoisRecord" )) {
10+ echo " Domain Name: $ ( $j.WhoisRecord.domainName ) "
11+ echo " Contact Email: $ ( $j.WhoisRecord.contactEmail ) "
12+ } else {
13+ echo $j
14+ }
You can’t perform that action at this time.
0 commit comments