NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Help need very simple script

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 07-28-2007, 10:11 PM THREAD STARTER               #1 (permalink)
New Member
Join Date: Jun 2005
Posts: 15
Taboo is an unknown quantity at this point
 



Help need very simple script


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!
Taboo is offline  
Old 07-29-2007, 03:52 PM   #2 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
PHP Code:
<?php
????: NamePros.com http://www.namepros.com/programming/355340-help-need-very-simple-script.html
/*
    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
????: NamePros.com http://www.namepros.com/showthread.php?t=355340
        
$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>
cef is offline  
Old 07-29-2007, 08:12 PM THREAD STARTER               #3 (permalink)
New Member
Join Date: Jun 2005
Posts: 15
Taboo is an unknown quantity at this point
 



Thank you cef, you rock! <3
Taboo is offline  
Old 07-30-2007, 05:54 AM   #4 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
No prob

Post back if you need any tweaks.
cef is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:24 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger