- Impact
- 83
This script may have some errors and it may not get all domains, but it's pulled every domain out of anything I've pasted thus far. Let me know of any errors that need addressed.
Demo: http://www.freedomcatcher.com/domain_parser.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Domain Name Extractor - DomainIdiot © 2013-Present</title>
</head>
<body>
<h1>Domain Name Extractor, © 2013 - Present [DomainIdiot]</h1>
<form method="post" action="<?php echo @$_SERVER['PHP_SELF']; ?>">
Copy and paste bulk data below to extract all domains from the data:<BR />
<textarea name="rawData" style="width:800px;height:400px;"><?php echo htmlspecialchars(@$_POST["rawData"]); ?></textarea>
<BR>
<input type="submit" value="Parse Domains...">
</form>
<?php
function processDomains($domList){
$extensionList = "ac,ae,aero,af,ag,al,am,as,asia,at,au,az,ba,be,bg,bi,biz,bj,br,br.com,bt,by,bz,ca,cat,cc,cd,ch,ck,cl,cn,cn.com,co,co.nl,com,coop,cx,cy,cz,de,dk,dm,dz,edu,ee,eg,es,eu,eu.com,fi,fo,fr,gb,gb.com,gb.net,qc.com,ge,gl,gm,gov,gr,gs,hk,hm,hn,hr,hu,hu.com,ie,il,in,info,int,io,iq,ir,is,it,je,jobs,jp,ke,kg,kr,la,li,lt,lu,lv,ly,ma,mc,md,me,mil,mk,mobi,ms,mt,mu,mx,my,name,net,nf,ng,nl,no,no.com,nu,nz,org,pl,pr,pro,pt,ro,ru,sa,sa.com,sb,sc,se,se.com,se.net,sg,sh,si,sk,sm,st,su,tc,tel,tf,th,tj,tk,tl,tm,tn,to,tp,tr,travel,tw,tv,tz,ua,uk,uk.com,uk.net,gov.uk,us,us.com,uy,uy.com,uz,va,vc,ve,vg,ws,xxx,yu,za.com";
$eL = "";
$extensionList = explode(",",$extensionList);
$domList = str_replace("
"," ",$domList);
$domList = str_replace("/"," ",$domList);
$domList = str_replace("www.","",$domList);
$domList = explode(" ",$domList);
$full_return = "";
foreach($extensionList as $a){
$eL[] = ".".$a;
}
foreach ($domList as $a){
$a = explode(" ",$a);
foreach($a as $b){
if(strstr($b,".")){
$domain = explode(".",$b);
$prefix = $domain[0];
$extension = "";
for($i=1;$i<=count($domain)-1;$i++){
$extension .= ".".$domain[$i];
}
if(strlen($prefix) >= 1 && strlen($extension) >= 1){
if(in_array(strtolower($extension),$eL)){
$full_return[] = strtolower($prefix.$extension);
}
}
}
}
}
$full_return = @array_unique($full_return);
$returnOut = "";
if(@$full_return){
foreach($full_return as $a){
$returnOut .= $a."\n";
}
}
return $returnOut;
}
echo nl2br(processDomains(@$_POST["rawData"]));
?>
</body>
</html>
Demo: http://www.freedomcatcher.com/domain_parser.php
Last edited: