Preg_match_all email finder

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cezar62
Forum Newbie
Posts: 1
Joined: Tue Jan 14, 2014 12:16 am

Preg_match_all email finder

Post by cezar62 »

Hii

COD------
<?
/////////////////////////////////////////////////////////////////////
$ossz = mysql_connect("localhost", "root", "nico5") or die(mysql_error());
mysql_select_db("linkkereso",$ossz) or die(mysql_error());
//////////////////////////////////////////////////////////////////////
$email_sql = "select * from email ";
$eredmeny = mysql_query($email_sql) or die(mysql_error());
///////////////////////////////////////////////////////////////////////////////
//*****************************************************************************
// http://weblabor.hu/forumok/temak/15793

// $link-- 3 piece email adress

$link = "http://localhost/pok/proba.html";

$forras = file_get_contents($link);

if (preg_match_all("/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i", $forras, $tomb))

{
for($x=0;$x<count($tomb);$x++)
{
for($y=0;$y<count($tomb[$x]); $y++ )
{


if ($tomb[$x][$y] != "http")
{
print $tomb[$x][$y]."\r\n<br />";


$ujlink = "insert into email values ('', '$tomb[$x][$y]', '', '', '', '')";
mysql_query($ujlink) or die(mysql_error());

}
}
}
}

?>
The print $tomb[$x][$y] I would like to save database but do not know how to ?
Thanks in advance !
Post Reply