[advanced search]
Results from the most recent live auction are here.
8 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 04-16-2004, 03:05 PM   · #1
deadserious
Senior Member
 
Trader Rating: (13)
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (Donate)
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
Thumbs up Simple Domain List Cleaner in PHP

This simply extracts the first occurence of a domain name from every line you enter in the textarea and only prints the domain once if it occurs on multiple lines. You can change the regex to better suit your needs. I have it the way it is to prevent it from matching things such as file.php or file.gif if you enter a bunch of source code or something.

PHP Code:
<html>
<
head>
<
title>Domain List Cleaner</title>

<
body>

<
center>
<
form method="post" action="">
<
textarea name="domains" rows="15" cols="60">
<?
php
$temparray
= array();
$domains = $_POST['domains'];
if (
$domains)
{
    
$list = split("\r\n", $domains);
    foreach (
$list as $value)
    {
        
preg_match("/[a-z-A-Z0-9-]+\.(com|net|org|us|biz|info|cc)/", $value, $matches);
        
        for (
$i = 0; $i < count($matches); $i++)
        {
            
array_push($temparray, $matches[0]);
        }
    }
    
    
$uniquearray = array_unique($temparray);

    foreach (
$uniquearray as $uniquevalue)
    {
        echo
"$uniquevalue\n";
    }
}
?>
</textarea>
<br />
<input type="submit" value="Process">
</form>
</center>

</body>
</html>


Please register or log-in into NamePros to hide ads

Last edited by deadserious : 04-16-2004 at 03:08 PM.
deadserious is offline   Reply With Quote
Old 04-16-2004, 03:36 PM   · #2
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
so if i was to enter

bob.com
bob.org
bob.net
bob.com

it would remove the first bob.com?
adam_uk is offline   Reply With Quote
Old 04-16-2004, 04:03 PM   · #3
deadserious
Senior Member
 
Trader Rating: (13)
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (Donate)
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
Yes it would, or actually the second

Here's the results for pasting the entire html source code from the namepros.com homepage:

namepros.com
TD.info
vBStyles.net
google.com
DomainEmpire.com
CoolHost.com
googlesyndication.com
qksrv.net


deadserious is offline   Reply With Quote
Old 04-17-2004, 03:19 AM   · #4
adam_uk
Senior Member
 
Trader Rating: (17)
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (Donate)
adam_uk is a jewel in the roughadam_uk is a jewel in the roughadam_uk is a jewel in the rough
Breast Cancer
ah right wicked!

thats a handy little script
adam_uk is offline   Reply With Quote
Old 05-13-2004, 03:06 AM   · #5
insanity
NamePros Regular
 
Name: James
Location: Australia
Trader Rating: (4)
Join Date: Dec 2003
Posts: 762
NP$: 159.00 (Donate)
insanity is on a distinguished road
nice! looks like a sweet little script, gonna give it a try.. thanks!
insanity is offline   Reply With Quote
Old 05-13-2004, 06:05 AM   · #6
InteractAsia
Connecting the World
 
InteractAsia's Avatar
 
Location: Merlion City
Trader Rating: (14)
Join Date: Nov 2003
Posts: 1,220
NP$: 75.00 (Donate)
InteractAsia has a spectacular aura aboutInteractAsia has a spectacular aura about
nice script there..thanks
__________________
ermm..do i need to put my sig here?
Free Short URL | Free Reseller Hosting | Free cPanel Blog Hosting
Hottest New Posters & Prints
InteractAsia is offline   Reply With Quote
Old 05-26-2004, 05:49 PM   · #7
axilant
Account Closed
 
axilant's Avatar
 
Name: Cody Selzer
Location: /etc/passwd
Trader Rating: (40)
Join Date: May 2004
Posts: 2,194
NP$: 0.00 (Donate)
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
Member of the Month
July 2005
very nice code... i think i might use it
axilant is offline   Reply With Quote
Old 05-26-2004, 07:08 PM   · #8
armstrong
Man from Manila
 
armstrong's Avatar
 
Name: Apollo
Location: The Net
Trader Rating: (55)
Join Date: Jul 2003
Posts: 6,847
NP$: 701.50 (Donate)
armstrong has much to be proud ofarmstrong has much to be proud ofarmstrong has much to be proud ofarmstrong has much to be proud ofarmstrong has much to be proud ofarmstrong has much to be proud ofarmstrong has much to be proud ofarmstrong has much to be proud of
NamePros Hall of Fame
Autism Special Olympics
hmm. what happens if there are several valid domains in one line?
armstrong is offline   Reply With Quote
Old 05-27-2004, 03:34 AM   · #9
axilant
Account Closed
 
axilant's Avatar
 
Name: Cody Selzer
Location: /etc/passwd
Trader Rating: (40)
Join Date: May 2004
Posts: 2,194
NP$: 0.00 (Donate)
axilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to beholdaxilant is a splendid one to behold
Member of the Month
July 2005
thats what i was thinking as well.... I'll try to fix that
axilant is offline   Reply With Quote
Old 05-30-2004, 11:24 AM   · #10
deadserious
Senior Member
 
Trader Rating: (13)
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (Donate)
deadserious has a spectacular aura aboutdeadserious has a spectacular aura about
Quote:
Originally posted by armstrong
hmm. what happens if there are several valid domains in one line?


If you change this line:

$list = split("\r\n", $domains);

to something like this:

$list = split(" +", $domains);

That might do it
deadserious is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
http://www.mobisitetrader.com/ Click to Watch Instant Video http://www.mobisitetrader.com/
Advertise your business at NamePros
All times are GMT -7. The time now is 03:12 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0