<?php
$domain = "com"; // co.uk .ca .es
ini_set("memory_limit", "64M");
set_time_limit(0);
error_reporting(E_ALL ^ E_NOTICE);
print "Extracting...\n";
createFile("emails.txt");
$i=0;
$mailsFound=0;
$fileLink = file("list.txt");
$totalPages = count($fileLink);
foreach($fileLink as $fileNr => $u)
{
$i++;
$opf = fopen("tmps","w"); fwrite($opf,file_get_contents($u)); fclose($opf);
system("fmt tmps | grep \"ebay.$domain\" >> tmp");
$fl = file_get_contents("tmp");
preg_match_all("{\b(http):[\w/#~:.?+=&%@!\-.:?\-] +?(?=[.:?\-]*[^\w/#~:.?+=&%@!\-.:?\-]|$)}x",$fl,$fll);
foreach($fll[0] as $url) {
$url =trim($url); $url = str_replace("&", "", $url); $url = str_replace(""", "", $url);
if (preg_match("/ebay.$domain/i",$url)) {
//system("curl $url -s -o \"tmp2\"");
system("wget -q -O tmp2 $url");
$mm = getMails("tmp2");
foreach($mm[0] as $email) { $email = trim($email);
if (checkIfLineExists($email, "emails.txt")==0) {
$mailsFound++;
$flct = fopen("emails.txt", "a"); fwrite($flct, $email."\r\n"); fclose($flct); } } } }
system("rm -rf tmps tmp tmp2");
flush();
print "Pagina $i din $totalPages e gata -> Total: $mailsFound maile\r\n";
}
function checkIfLineExists($line, $in) { $inContents = implode('', file($in)); if (stripos($inContents, $line)!==false) { return true; } else { return false; }};
function createFile($file) { if (!(file_exists($file))) { touch($file); }};
function after ($this, $inthat) { if (!is_bool(strpos($inthat, $this))) return substr($inthat, strpos($inthat,$this)+strlen($this)); };
function before ($this, $inthat){ return substr($inthat, 0, strpos($inthat, $this)); };
function btwStr ($this, $that, $inthat){ return before($that, after($this, $inthat));};
function getMails($from) { $fl = file_get_contents($from); preg_match_all("/([\s]*)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*([ ]+|)@([ ]+|)([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,}))([\s]*)/i", $fl, $fll); return $fll; };
?>