Twitter Email Extractor Script

thanks for the quick update, but a

"<b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>tweet.php</b> on line <b>99</b><br "

if i try to change the "HOW MANY TWITTER" option to 20, I guess it works perfectly when I only set it to '1' .. LOL

i guess there's a problem with the 30second limit?

ty fo the reply..

i think this script this be tweaked better way.....i am also getting maximum execution time error.

You need to increase max execution time in your php.ini file
 
i think this script this be tweaked better way.....i am also getting maximum execution time error.
You will if your PHP is set up with the default, which is like 30 seconds. Try adding the following to the top of the script, right after the '<?php':
Code:
[B]set_time_limit[/B] (900);
That should let the script run for 900 seconds (15 minutes). Adjust as necessary if you need a longer time. If you are on a shared host they may override this, but it should work.
 
thanks it worked. I extracted 100 pages email ids at once. But skippy is it possible to give start and end page numbers.....so that after i search for 100pages ...i can search from 101 to 200 pages :)
 
thanks it worked. I extracted 100 pages email ids at once. But skippy is it possible to give start and end page numbers.....so that after i search for 100pages ...i can search from 101 to 200 pages :)

I've modified Spikyy's code a bit to include this. Not touching his credits, just adding in the 15minute timeout, starting page number, and button to quickly highlight the text (like the BHW "Select All" buttons).

Code:
<?php
set_time_limit (900);
/*************************
*
* Twitter Email extractor v.1
*
* author: spikyy @ BlackHatWorld
*/

if(!isset($_GET['action'])) {
      
      $file = $_SERVER["SCRIPT_NAME"];
      $break = Explode('/', $file);
      $pfile = $break[count($break) - 1]; 
      
      print_r('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Twitter Email Extractor</title>
</head><body bgcolor="#7DE3F9">
<center> <h1>Twitter Extractor v.1</h1> <br />
<form action="'.$pfile.'?action=do" method="post">
<table width="70%" height="70%" bgcolor="#BBEFFA" border="0">
<tr> <td width="33%" height="100%" valign="center" align="left" >
<center><b> Starting page number: </b> <br /><br />
<input name="pagestart" type="text" size="2" value="1"><br /><br />
<b> How many Twitter pages: </b> <br /><br />
<input name="pagenr" type="text" size="2" value="10">
<br /><br /><b>Tweple country:</b><br /> (English = en, Spanish = es)
<br /><br /><input type="text" name="country" value="en" size="2">
<br /><br /> <br /><input type="submit" value="Search for Emails!" size="6">
</center></td><td width="33%" height="100%" valign="center" ><center>
<b>Are you using keywords ? </b><select name="keyword"> <option>yes</option> <option selected="selected">no</option>  </select>
<br /><br /><textarea name="keywords" rows="10" cols="20">
keyword1
keyword2
keyword3</textarea></center></td>
<td width="33%" height="100%" valign="center" >
<center><b>Domain type for searching:</b><br /><br />
<textarea name="domains" rows="10" cols="20">
gmail.com
yahoo.com
msn.com
aol.com
hotmail.com</textarea></center></td>
</tr></table></form></center> </body></html>
');
      
  } else {
      
print_r('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Twitter Email Extractor</title>  
</head>
<body bgcolor="#7DE3F9">
<center> <h1>Twitter Extractor v.1</h1> 
<br />
<table width="70%" height="70%" bgcolor="#BBEFFA" border="0">
<tr> 
<td width="100%" height="100%" valign="center" align="center">
<b>Extracting ... </b><br /><br />
<form>
<textarea id="twtResults" cols="30" rows="20">');
  
  $err = 0;
  if(isset($_POST['pagestart']) && $_POST['pagestart'] != "") { $pagenr = $_POST['pagestart'];
 
  } else { $err = 1; $errn = $errn."\n Starting page number is missing"; }
  
  if(isset($_POST['pagenr']) && $_POST['pagenr'] != "") { $pagenr = $_POST['pagenr'];
 
  } else { $err = 1; $errn = $errn."\n Number of pages is missing"; }
  
  if(isset($_POST['country']) && $_POST['country'] != "") { $country = $_POST['country']; 
  
  } else { $err = 1; $errn = $errn."\n Country is missing"; }
  
  if(isset($_POST['keyword']) && $_POST['keyword'] != "") { $keyword = $_POST['keyword']; 
  
  } else { $err = 1; $errn = $errn."\n Keyword option is missing"; }
  
  if($keyword == "yes") { if(isset($_POST['keywords']) && $_POST['keywords'] != "") { $keywords = $_POST['keywords']; 
  
  } else { $err = 1; $errn = $errn."\n Keywords missing"; } }
  
  if(isset($_POST['domains']) && $_POST['domains'] != "") {$domains = $_POST['domains']; 
  
  } else { $err = 1; $errn = $errn."\n Domains missing"; }
  
  if($err == 0)     { 
  
     $domains = nl2br($domains);
     $domains = explode('<br />', $domains);
     foreach($domains as $dd)
     {
       $domainsvar = $domainsvar.trim($dd)."+";   
     }
     $domainsvar = strrev(substr(strrev($domainsvar), 1));
     if($keyword == "yes") {
      
      $keywords = nl2br($keywords);
      $keywords = explode('<br />', $keywords); 
           
     foreach($keywords as $key) {
         
     for($i=$pagestart; $i <= ($pagestart + $pagenr); $i++) {
     
     $file = file_get_contents("http://search.twitter.com/search?page=".$i."&rpp=100&ands=".trim($key)."&ors=".$domainsvar."&lang=".$country);
     $file = strip_tags($file);
 
     $matches = "";
     
     preg_match_all("([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\b)siU", $file, $matches);
     
     foreach($matches[0] as $mtt) {        
         echo trim($mtt)."\n"; ob_flush(); flush();
     }        
         
         
     }  }   }  else {
         
     for($i=$pagestart; $i <= ($pagestart + $pagenr); $i++) {
     
     $file = file_get_contents("http://search.twitter.com/search?page=".$i."&rpp=100&ors=".$domainsvar."&lang=".$country);
     $file = strip_tags($file);
     
     $matches = ""; 
 
     preg_match_all("([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\b)siU", $file, $matches);
     
     foreach($matches[0] as $mtt) {        
         echo trim($mtt)."\n";ob_flush();flush();}         
         }
     
     
     }        

  
  } else {
      
      echo "Errors:".$errn;
  
  } 
  
   
  print_r('</textarea>
  <br>
  <input type="button" value="Select Text" onClick="javascript:this.form.twtResults.focus();this.form.twtResults.select();">
  </form>
<br />
<font color="red" size="5"><b> DONE !!! </b></font>
</td></tr>  
</body>
</html>'); 
      
      
  }
  
  
  
  
  
  
?>
 
Just an FYI - for you guys hosting this publicly, it's using your server's bandwidth and IP, not the visitor's browser. HealeyV3, DreamHost might look down on this, considering there are 23 other websites being hosted on the same server you're using.

To get past the timeout issue, you may need to adjust your server's PHP.ini file and set output_buffering to On. DreamHost lets you do this:
http://www.wiki.dreamhost.com/index.php/PHP.ini
 
I updated the twitter email extractor script with all the features requested and also made a separated thread in Member downloads section
CLICK HERE
 
twitter members dont pay attention unless somebody BIG says somthing
 
Thanks for this script... should be awesome once I get it to work lol
 
FYI - using the PHP command "file_get_contents" is limited. If anyone is interested I can update the script to use PHP cURL (a more reliable way of scraping webpages) in which you'll also be able to plug in proxies....
 
I'm fairly new to email scraping, and I don't know much about coding. What software do you input this code into, and you use it with outwit hub?
 
FYI - using the PHP command "file_get_contents" is limited. If anyone is interested I can update the script to use PHP cURL (a more reliable way of scraping webpages) in which you'll also be able to plug in proxies....

Yes please do that.
 
These scripts are owsome, simple and owsome. thanks you either if you made them or just shared from somewhere else, you just got me some time that i would'v waste on searching.
Thanks to all of you.
 
Back
Top