How To Find Other Web Sites Hosted on a Web Server

Authors: CodeToday | PHP Code | Views: 669 | Posted: 05 AM: 09/05/2017

How To Find Other Web Sites Hosted on a Web ServerCurrently offers free and unlimited if you use to get websites with the same IP address you can use directly on by querying{ip address} (example: or you can use php code to filter only domain names that are not on 

This article uses the following knowledge

  1. file_get_contents: Get data from, you can use curl_init() instead of file_get_contents
  2. preg_match_all: Parse the text to filter out url links
  3. parse_url: parse url to filter out domain names
We will start with the html form. This form is to get data from input IP


<form action="" method="post" class="form-horizontal">
<div class="form-group">
<input type="text" name="ip" id="ip" value="<?=$_POST['ip']?>" class="form-control" placeholder = "Enter IP address server here ..." required/>
<div class="form-group">
<button type="submit" name="submit" class="btn btn-info">Find Now</button>

After receiving the data from the form will put on the query link on'.$_POST['ip']

Note: you must have an IP prefix: before the ip address in the query and you can add count = [10,20, ...50] to get the number of domains you want


$pattern  = "<as[^>]*href=("??)([^" >]*?)1[^>]*>(.*)</a>"; // filter url

This syntax is used to filter the link contained in the returned data, based on which will filter out the domain name

Source Code PHP


$ipServer = $_POST['ip'];
$content  = file_get_contents(''.$ipServer);
$pattern  = "<as[^>]*href=("??)([^" >]*?)1[^>]*>(.*)</a>"; // filter url
if(preg_match_all("/$pattern/siU", $content, $matches, PREG_SET_ORDER)) {
	foreach($matches as $match) {	
		$domain     = parse_url($match[2]);
		$domainHost = $domain[host];
		if($domainHost != '' && $domainHost != '' && $domainHost != '') {
			 $domainServer[] = str_replace('www.','',$domainHost);

print_r( array_unique($domainServer));


In addition, you can use the curl_init() function as below

$url = ''.$ipServer;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);

Find Other Web Sites Hosted on a Web Server by use RSS

You can use this way, it's easy if you know the xml regular expression. You can use this way, it's easy if you know the xml regular expression. You need to add the format = rss query after the query from'.$ipServer.'&format=rss
PHP code for RSS

$content = file_get_contents(''.$ipServer.'&format=rss');
$data = new SimpleXmlElement($content);
foreach($data->channel->item as $entry) {
  $title      = $entry->title; // get title
  $link       = $entry->link; // get link
  $des        = $entry->description; // get description
  $domainPath = parse_url($linkDm);
  $domainHost = $domainPath[host];
  echo $domainHost;
If you have any questions, please leave a message below