Blame view

exportMailAddress.php 777 Bytes
Frederick committed
1 2 3
<?php
require_once("../include.php");

sn committed
4
$content =  mcFile::getFileContent('Adressbuch_joufixe20110806.ldif');
Frederick committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

//print_r($content);
$array_mail = array();
$string_mail = '';
foreach($content as $lnr =>  $line) {
//	preg_match_all('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/', $line, $treffer, PREG_SET_ORDER);

	$pattern="/([\s]*)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*([ ]+|)@([ ]+|)([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,}))([\s]*)/i"; 
	preg_match_all($pattern, $line, $treffer);

	if(array_key_exists(0, $treffer) && array_key_exists(0, $treffer[0])) {
		$array_mail[] = $treffer[0][0];
		$string_mail .= $treffer[0][0];
	} else {
		echo($lnr.': '.$line."\n");

	}

}
print_r($array_mail);

sn committed
26
mcFile::write('Adressbuch_joufixe20110806.txt', $string_mail);
Frederick committed
27 28

?>