Results from the most recent live auction are here .
8 members in the live chat room. Join Chat !
04-16-2004, 03:05 PM
· #1 Senior Member
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (
Donate )
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>
Last edited by deadserious : 04-16-2004 at 03:08 PM .
04-16-2004, 03:36 PM
· #2 Senior Member
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (
Donate )
so if i was to enter
bob.com
bob.org
bob.net
bob.com
it would remove the first bob.com?
04-16-2004, 04:03 PM
· #3 Senior Member
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (
Donate )
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
04-17-2004, 03:19 AM
· #4 Senior Member
Join Date: May 2003
Posts: 2,211
NP$: 6170.25 (
Donate )
ah right wicked!
thats a handy little script
05-13-2004, 03:06 AM
· #5 NamePros Regular
Name: James
Location: Australia
Join Date: Dec 2003
Posts: 762
NP$: 159.00 (
Donate )
nice! looks like a sweet little script, gonna give it a try.. thanks!
05-13-2004, 06:05 AM
· #6 Connecting the World
Location: Merlion City
Join Date: Nov 2003
Posts: 1,220
NP$: 75.00 (
Donate )
nice script there..thanks
05-26-2004, 05:49 PM
· #7 Account Closed
Name: Cody Selzer
Location: /etc/passwd
Join Date: May 2004
Posts: 2,194
NP$: 0.00 (
Donate )
very nice code... i think i might use it
05-26-2004, 07:08 PM
· #8 Man from Manila
Name: Apollo
Location: The Net
Join Date: Jul 2003
Posts: 6,847
NP$: 701.50 (
Donate )
hmm. what happens if there are several valid domains in one line?
05-27-2004, 03:34 AM
· #9 Account Closed
Name: Cody Selzer
Location: /etc/passwd
Join Date: May 2004
Posts: 2,194
NP$: 0.00 (
Donate )
thats what i was thinking as well.... I'll try to fix that
05-30-2004, 11:24 AM
· #10 Senior Member
Join Date: Aug 2002
Posts: 1,300
NP$: 2.85 (
Donate )
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
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off