View Single Post
Old 02-24-2009, 08:47 PM  
fallenmuffin
Confirmed User
 
fallenmuffin's Avatar
 
Industry Role:
Join Date: Nov 2005
Posts: 8,170
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);
}

?>
fallenmuffin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote