NameSilo

Help need very simple script

Spaceship Spaceship
Watch

Taboo

Established Member
Impact
0
I can't seem to find a basic php script that lets me paste in about 1000 or so rows of keywords w/ spaces. Then have that script remove the spaces and add .com so that the keywords turn into a domains.

i.e. big boobs=bigboobs.com etc

any help appreciated!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
<?php
/*
	Displays a form which lets you enter a list of whitespace-separated keywords
on each line.  When the form is submitted, it converts the list into .com  domain names
	by stripping the whitespace and adding .com to each line.

	If a line already ends in .com, another is not added.
	.com is not added to the end of blank lines.
	
*/
if (isset($_POST['keywords'])) // convert
{
	// break the text area into lines
	$lines = explode("\n", $_POST['keywords']);
	for ($i=0; $i<count($lines); $i++)
	{
		// strip whitespace
		$lines[$i] = preg_replace('/\s+/', '', $lines[$i]);		
		// append .com if not present
		if ($lines[$i] && substr_compare($lines[$i],'.com',-4,4,true) !== 0)
			$lines[$i] .= '.com';
	}
	
	// make the list display safe
	$keywords = htmlentities(implode("\n",$lines));
}
else // initialize
{
	$keywords = '';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

	<title>Domain Maker</title>
	
</head>
<body>
	<p>
		Enter or paste a list of whitespace-separated keywords below.  When you press the
		"convert" button, the list will be converted into a list of .com domain names.
	</p>
	<form action="" method="post">
	    <textarea cols="64" rows="10" name="keywords"><?php echo $keywords; ?></textarea><br />
	    <input type="submit" value="convert" />
	</form>
</body>
</html>
 
0
•••
Thank you cef, you rock! <3
 
0
•••
No prob :)

Post back if you need any tweaks.
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back