Enjoy.
Code:
<?php
/* *************************
* Fallen Muffin Media
* http://www.fallenmuffin.com/
************************* */
$database = '/path/to/textfile.txt';
$path = '/path/to/html/files'; // no ending slash, make sure dir is chmod 777
/* ***************************
* No modifications below this line
*************************** */
$pieces = @file($database);
foreach ($pieces as $piece) {
// get domain from url
preg_match('@^(?:http://)?([^/]+)@i', $piece, $matches);
$host = $matches[1];
preg_match('/[^.]+\.[^.]+$/', $host, $matches);
$domain = $matches[0];
// data to write to html file
$data = "<html><head><title>$domain</title></head><body><a href=\"$piece\">$domain</a></body></html>";
// generate html file
$fp = fopen($path.'/'.$domain.'.html', 'w');
fwrite($fp, $data);
fclose($fp);
}
?>