Last active
June 11, 2016 02:56
-
-
Save bogdanovich/aa5c94297263d6187cb835972fe486a4 to your computer and use it in GitHub Desktop.
API Spyonweb.com PHP example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$site = "fullmooncalendar.net"; | |
$url = 'https://api.spyonweb.com/v1/domain/'.$site.'?access_token=YOUR_TOKEN_HERE'; | |
$response = file_get_contents($url); | |
$data = json_decode($response, true); | |
echo "<pre>\r\n"; | |
if ($data['status'] == "found") { | |
echo "Status: ".$data['status']."\r\n"; | |
// domain summary | |
if (isset($data['result']['domain'])) { | |
$domainName = key($data['result']['domain']); | |
$domainItems = $data['result']['domain'][$domainName]['items']; | |
echo "Summary: \r\n"; | |
echo " Domain: ".$domainName."\r\n"; | |
if (isset($domainItems['adsense'])) { | |
echo " Adsense IDs:\r\n"; | |
foreach($domainItems['adsense'] as $id => $numDomains) { | |
echo " ".$id.": ".$numDomains." domains\r\n"; | |
} | |
} | |
if (isset($domainItems['analytics'])) { | |
echo " Analytics IDs:\r\n"; | |
foreach($domainItems['analytics'] as $id => $numDomains) { | |
echo " ".$id.": ".$numDomains." domains\r\n"; | |
} | |
} | |
if (isset($domainItems['ip'])) { | |
echo " IP Addresses:\r\n"; | |
foreach($domainItems['ip'] as $id => $numDomains) { | |
echo " ".$id.": ".$numDomains." domains\r\n"; | |
} | |
} | |
if (isset($domainItems['dns_servers'])) { | |
echo " DNS Servers:\r\n"; | |
foreach($domainItems['dns_servers'] as $domain => $ip) { | |
echo " ".$domain.": ".$ip."\r\n"; | |
} | |
} | |
} | |
//adsenseId info | |
$partialResult = $data['result']['adsense']; | |
if (isset($partialResult)) { | |
echo "\r\nAdsense Info\r\n"; | |
foreach($partialResult as $id => $info) { | |
if ($info['fetched'] > 0) { | |
echo " ".$id.": \r\n"; | |
foreach($info['items'] as $domain => $lastSeen) { | |
echo " ".$domain."\r\n"; | |
} | |
} | |
} | |
} | |
//analyticsId info | |
$partialResult = $data['result']['analytics']; | |
if (isset($partialResult)) { | |
echo "\r\nAnalytics Info\r\n"; | |
foreach($partialResult as $id => $info) { | |
if ($info['fetched'] > 0) { | |
echo " ".$id.": \r\n"; | |
foreach($info['items'] as $domain => $lastSeen) { | |
echo " ".$domain."\r\n"; | |
} | |
} | |
} | |
} | |
//IP info | |
$partialResult = $data['result']['ip']; | |
if (isset($partialResult)) { | |
echo "\r\nIP Info\r\n"; | |
foreach($partialResult as $id => $info) { | |
if ($info['fetched'] > 0) { | |
echo " ".$id.": \r\n"; | |
foreach($info['items'] as $domain => $lastSeen) { | |
echo " ".$domain."\r\n"; | |
} | |
} | |
} | |
} | |
//DNS Domain info | |
$partialResult = $data['result']['dns_domain']; | |
if (isset($partialResult)) { | |
echo "\r\nDNS Domain Info\r\n"; | |
foreach($partialResult as $id => $info) { | |
if ($info['found'] > 0) { | |
echo " ".$id.": ".$info['found']." domains hosted\r\n"; | |
} | |
} | |
} | |
//IP-DNS info | |
$partialResult = $data['result']['ip_dns']; | |
if (isset($partialResult)) { | |
echo "\r\nIP-DNS Info\r\n"; | |
foreach($partialResult as $id => $info) { | |
if ($info['found'] > 0) { | |
echo " ".$id.": ".$info['found']." DNS domains\r\n"; | |
} | |
} | |
} | |
} | |
echo "</pre>\r\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment