Created
October 31, 2011 06:36
-
-
Save zachbrowne/1327025 to your computer and use it in GitHub Desktop.
Find Domains on same IP with PHP
This file contains hidden or 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 | |
function reverseIP($IP) | |
{ | |
for($f=0; $f <= 2; $f++) | |
{ | |
// this will list the results in the first two page...alter the code to get results from more number of pages | |
$url='<a class="linkclass" href="http://www.bing.com/search?q=ip%3A">http://www.bing.com/search?q=ip%3A</a>'.$IP.'&first='.$f.'1&FORM=PORE'; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER[‘HTTP_USER_AGENT’]); | |
curl_setopt($ch, CURLOPT_REFERER, "<a class="linkclass" href="http://yahoo.com/">http://yahoo.com/</a>"); | |
curl_setopt($ch, CURLOPT_MAXREDIRS, 5); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 5); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_TIMEOUT, 20); // times out after 15s | |
$searchResults= curl_exec($ch); | |
curl_close($ch); | |
$parsedData=explode("<li>",$searchResults); | |
$cntArray=count($parsedData); | |
for($x=0;$x<$cntArray;$x++) | |
{ | |
if (preg_match('#<cite>(.*?)</cite>#i',$parsedData[$x], $matches)) | |
{ | |
$fullURL[]=$matches[1]; | |
} | |
} | |
$cntURL=count($fullURL); | |
for($y=0; $y < $cntURL; $y++) | |
{ | |
$result=explode('/',$fullURL[$y]); | |
$TLD[]=$result[0]; | |
} | |
} | |
$uniqueTLDList=@array_unique($TLD); // we just want the unique domain names | |
return $uniqueTLDList; | |
} | |
echo '</li>'; | |
// specify the IP of your interest | |
$arr=reverseIP('69.162.116.154'); | |
$size=sizeof($arr); | |
for($i=0;$i<$size;$i++) { | |
echo $arr[$i].'<br>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment