<pre>
<?php
$newline = "\n";
$hit = 0;
$id = "id";
while ($hit < 10) {
$a = rand(0, 255);
$b = rand(0, 255);
$c = rand(0, 255);
$d = rand(0, 255);
$name = gethostbyaddr("$a.$b.$c.$d");
if (!strpos($name, $id) === false) {
print " " . "<a href=$name>$name</a>" . $newline;
$hit = $hit + 1;
}
}
print $newline;
print "Copyright Search Engine" . $newline;
?>
This is a Little Search Engine, for the Private Entrepreneur,
or it Would be, if it Worked.
The Code Executes, it is Just Incredible Slow.
Does Anybody Know why.
In Case the Code is Value, and the Title is NeoSearch, the Sales Conditions, are these.
Information
Order
10% Promille
One Million Dollars US
Rex:.
Many sites don't have their reverse DNS set up properly, so calling
gethostbyaddr()
will be slow if you hit any of those addresses.Also, you should probably limit
$a
torand(0, 223)
. Anything outside this range is multicast addresses, not useful for a search engine.Even fixing this, your code will necessarily be slow. You're looking for addresses that resolve to names with
id
in them. The vast majority of names don't fit that pattern, so you'll have to test thousands of names before you get 10 that you want.This is not how real search engines work, they don't look up random IPs. They start with a set of well known known web pages, and then follow links in all the pages to find other sites.