function fetch_page_email($pageNo) { $DOT = "."; $g_ofile = "mc.page" . $pageNo . $DOT . "email"; $fhandle = fopen($g_ofile, "w"); //get page $pageUrl = "http://www.mediaclubofindia.com/profiles/friend/list?page=" . $pageNo; $pageHtml = fetch_page($pageUrl); printf("page = %s \n", $pageUrl); $profiles = get_profile_url($pageHtml); //print_r($profiles); exit ; foreach ($profiles as $profile) { $buffer = get_profile_email($profile); fwrite($fhandle, $buffer); } }
function main_loop() { $root = "http://toostep.com/knowledge/a/all/popular/"; $ofile = "toostep.email"; $fhandle = fopen($ofile, "a"); //rajeev - till 1000 for ($page = 101; $page <= 200; $page++) { $pageUrl = $root . $page; $profiles = get_profile_url($pageUrl); foreach ($profiles as $profile) { $data = get_profile_email($profile); $buffer = NULL; if (empty($data) || is_null($data)) { $buffer = sprintf("__NO_DATA__ %s \n", $profile); } else { $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]); } fwrite($fhandle, $buffer); } } //close resources fclose($fhandle); }
function main_loop() { global $g_root; global $g_ofile; $fhandle = fopen($g_ofile, "w"); //rajeev - till 1000 for ($page = 201; $page <= 300; $page++) { $pageUrl = $g_root . $page; $profiles = get_profile_url($pageUrl); foreach ($profiles as $profile) { $data = get_profile_email($profile); $buffer = NULL; if (empty($data) || is_null($data)) { $buffer = sprintf("__NO_DATA__ %s \n", $profile); } else { $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]); } fwrite($fhandle, $buffer); } } //close resources fclose($fhandle); }
function run_on_name($ch, $name, $pageNo) { global $g_debug; $DOT = "."; $g_ofile = urlencode($name) . $DOT . time() . $DOT . "email"; $fhandle = fopen($g_ofile, "w"); while (1) { $dtime = time() . "999"; $params = array("pageNo" => $pageNo, "type" => "page", "archive" => "0", "d" => $dtime); $qstring = http_build_query($params); $pageUrl = "http://toostep.com/searchUserAjax.html?" . $qstring; if ($g_debug) { print_r($params); printf("page = %s \n", $pageUrl); } $pageHtml = do_post($ch, $pageUrl, $name); if ($g_debug) { echo $pageHtml; } $profiles = get_profile_url($pageHtml); if (sizeof($profiles) == 0) { fclose($fhandle); //name processing finished return; } //print_r($profiles); exit ; //use profiles to get emails foreach ($profiles as $profile) { $data = get_profile_email($profile); $buffer = NULL; if (empty($data) || is_null($data)) { $buffer = sprintf("__NO_DATA__ %s \n", $profile); } else { $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]); } fwrite($fhandle, $buffer); } $pageNo++; } }
function run_on_name($name, $pageNo, $lookup) { global $g_debug; $ch = curl_init(); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20100101 Firefox/10.0.7 Iceweasel/10.0.7"); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $prefix = date("d-M-y"); $g_ofile = $prefix . "/" . $name . ".email." . time(); if (!file_exists(dirname($g_ofile))) { mkdir(dirname($g_ofile), 0755, true); } $fhandle = fopen($g_ofile, "w"); while (1) { $dtime = time() . "999"; $params = array("pageNo" => $pageNo, "type" => "page", "archive" => "0", "d" => $dtime); $qstring = http_build_query($params); $pageUrl = "http://toostep.com/searchUserAjax.html?" . $qstring; $pageHtml = do_post($ch, $pageUrl, $name); if ($g_debug) { printf(" \n\n ------ dumping search page having profiles ----- \n\n"); echo $pageHtml; } $profiles = get_profile_url($pageHtml); if (sizeof($profiles) == 0) { //free resources curl_close($ch); fclose($fhandle); //name processing finished return; } if ($g_debug) { printf(" \n\n ------- dumping extracted profiles from search page ----- \n\n "); print_r($profiles); } //use profiles to get emails foreach ($profiles as $profile) { $data = get_profile_email($profile); $buffer = NULL; if (empty($data) || is_null($data)) { $buffer = sprintf("__NO_DATA__ %s \n", $profile); } else { $buffer = sprintf("__DATA__ %s|%s|%s|%s \n", $data["email"], $data["name"], $data["title"], $data["company"]); } fwrite($fhandle, $buffer); if ($g_debug) { printf(" \n ----- wrote [%s] ----- \n ", $buffer); } } printf("processed %s - page %s \n", $name, $pageNo); $pageNo++; $lookup[$name] = $pageNo; //save name -page_no to disk save_lookup($lookup); } }