470,849 Members | 1,225 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Script to crawl email id from a file

<?php
//This script is written by Stalin to capture email id from a file
$fd=@fopen("email.txt","r");
if($fd)
echo "File is opened";
else
{
echo "No file is opened";
break;
}

$text=@fread($fd, filesize("email.txt")); //Read the file
$match=preg_split('/@/',$text,-1,PREG_SPLIT_OFFSET_CAPTURE); //split after @
$con = $match[0][0];
echo "<br>";
if (!$match[1][0])
echo "No mail id specified";
else {
$con1=strrev($con);
$match1=preg_split('/ /',$match[1][0],-1,PREG_SPLIT_OFFSET_CAPTURE);
echo "This is domain: ".$match1[0][0];
echo "<br>";
$match2=preg_split('/ /',$con1,-1,PREG_SPLIT_OFFSET_CAPTURE);
$name=$match2[0][0];
$revmatch=strrev($name);
//print_r($match2);
$id = $revmatch."@".$match1[0][0]; //combine the name and domain
echo "This is the email id : $id";
}
@fclose($fd);
?>


email.txt

Some sample sentences with email id within it...This php script will search any directory (and all subdirectories under that directory). It will show you the total size of the directory, number of files in the directory, and identify any files > or = to the size specified. When you run this script you will be prompted for the unix directory name and the test file size parameter. Here i give the mail of us which is somename@somedomain.com is our mail id. :)
Jul 28 '06 #1
2 2086
iam_clint
1,208 Expert 1GB
thats fantastic.. you got a question? :P
Jul 29 '06 #2
what question?? :confused: :)
Aug 1 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Martin Foster | last post: by
11 posts views Thread by Jonny | last post: by
2 posts views Thread by John | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.