PHP Emails Extractor

To easily extract emails from URL...

PHP Emails Extractor

php-emails-extractor.php

 

<?php

function extract_emails($str){
// This regular expression extracts all emails from a string:
//$regexp = '/([a-z0-9_\.\-])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i';
$regexp = '/([a-z0-9_\.\-])+(\@|\[at\])+(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i';
preg_match_all($regexp, $str, $m);

return isset($m[0]) ? $m[0] : array();
}

$link = $_GET['url'];

$domaine = explode("/",$link);
$getmail = file_get_contents($link);
$mails = extract_emails($getmail);
$mails = array_unique($mails);
$mcount = count($mails);
$mail = "";
if($mcount>0){

for($j=0;$j<$mcount;$j++){

$tempm = preg_replace("/\[at\]/","@",$mails[$j]);
$tempm = strtolower($mails[$j]);
$mail .= "\n".$tempm;

}
file_put_contents("mails-".$domaine[2].".txt", $mail);
}


$result = preg_replace("/\\n/","<br />",$mail);
if($mail == ""){$mail = "No emails found...";}
echo $mail;

?>

 

 

Ludo.One

Quality tools for Webmasters !

A collection of free or paid PHP scripts and Prestashop modules. Download free and paid website scripts and tools. Each of the PHP scripts here includes complete PHP source codes

Contact Details

Phone: +33781217982
Email:
Website: www.Ludo.One