Help need very simple script

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
Thank you cef, you rock! <3
 
0
Close
No prob :)

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

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back