dor@tehexploa
Registered Member
- Apr 25, 2009
- 95
- 26
I saw mention of a Twitter mass e-mail script in a thread tonight, and decided I would attempt to find it / make my own. This is almost my first PHP script so don't laugh at the superfluous code.. I am a huge newb, and I couldn't figure out how to increase the page # in a loop. Hope this helps somebody, because I read that there is one here on the board but is kept in a senior section.
Used http://hiderefer.org/?http://www.fromzerotoseo.com/twitter-email-grabber/ as a framework.
Directions:
1. Perform this search in your own browser: http://search.twitter.com/search?q=gmail.com+OR+hotmail.com++OR+%22email+me%22
2. Go to page 2 of search.
3. Copy and paste the 10 digit ID to replace the XXXXXXXXXX in the switch loop above.
(this can be done pretty easily with notepads replace function)
4. upload this script and an empty 'emails2.txt' (or change name) to your server
5. browse to this script..
takes about 1 minute for it to complete but def works nicely
any help on how to condense this would be greatly appreciated!
Code:
<?php
for($i=0;$i<102;$i++)
{
$url = "";
switch($i)
{
case 0:
$url= "http://search.twitter.com/search?q=gmail.com+OR+hotmail.com++OR+%22email+me%22";
break;
case 2:
$url= "http://search.twitter.com/search?max_id=XXXXXXXXXX&page=2&q=gmail.com+OR+hotmail.com++OR+%22email+me%22";
break;
case 3:
$url= "http://search.twitter.com/search?max_id=XXXXXXXXXX&page=3&q=gmail.com+OR+hotmail.com++OR+%22email+me%22";
break;
......... cycles ........ i kno i kno... i suck lol
case 99:
$url= "http://search.twitter.com/search?max_id=XXXXXXXXXX&page=99&q=gmail.com+OR+hotmail.com++OR+%22email+me%22";
break;
case 100:
$url= "http://search.twitter.com/search?max_id=XXXXXXXXXX&page=100&q=gmail.com+OR+hotmail.com++OR+%22email+me%22";
break;
}
$file = file_get_contents($url);
$file = strip_tags($file);
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);
ob_start();
print_r($matches);
$output = ob_get_clean();
file_put_contents( 'emails2.txt', file_get_contents('emails2.txt') . $output );
$file = array();
$matches = array();
$output = array();
// end of for loop - back to top!!
}
?>
Directions:
1. Perform this search in your own browser: http://search.twitter.com/search?q=gmail.com+OR+hotmail.com++OR+%22email+me%22
2. Go to page 2 of search.
3. Copy and paste the 10 digit ID to replace the XXXXXXXXXX in the switch loop above.
(this can be done pretty easily with notepads replace function)
4. upload this script and an empty 'emails2.txt' (or change name) to your server
5. browse to this script..
takes about 1 minute for it to complete but def works nicely
any help on how to condense this would be greatly appreciated!
Last edited: