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); } // constants $g_root = "http://toostep.com/knowledge/a/all/popular/"; $g_ofile = "profile.email." . time(); // copy cookies from browser session // or get from wget // wget --save-cookies wcookies.txt --keep-session-cookies --post-data "j_username=sri_saurabh2000@yahoo.com&j_password=Jantu211" http://toostep.com/j_security_check // $g_acegi_cookie = "c3JpX3NhdXJhYmgyMDAwQHlhaG9vLmNvbToxMzQ5Njc4Mzg4MjY5OjYyODdjZTljOTVkZTI1Y2NiNzIwODBjZGMwZWRmMDdi"; $g_session_cookie = "6A3DD831C32E3EDD4B713C7AF8D1BB5A.s2"; main_loop();
foreach ($events as $event) { if (!($event['mask'] & IN_MODIFY)) { continue; } echo stream_get_contents($file_fd); break; } } // May not happen inotify_rm_watch($inotify, $watch); fclose($inotify); fclose($file_fd); return 0; } ob_implicit_flush(1); if (!extension_loaded('inotify')) { fprintf(STDERR, "Inotify extension not loaded !\n"); exit(1); } if ($argc < 2) { fprintf(STDERR, "Usage: " . $argv[0] . " [FILE]\n"); exit(1); } $file = $argv[1]; if (!file_exists($file) || ($fd = fopen($file, "r")) === false) { fprintf(STDERR, "File '%s' does not exists or is not readable\n", $file); exit(1); } fseek($fd, 0, SEEK_END); exit(main_loop($file, $fd));