| 1 | #!/usr/bin/php |
| 2 | <?php |
| 3 | //HTML Mail parser 0.4 |
| 4 | //<-Harvie 2oo7 |
| 5 | /* |
| 6 | *This thing checks URLs from STDIN and printing found E-Mails to STDOUT. |
| 7 | *Use it well... |
| 8 | */ |
| 9 | |
| 10 | $in = fopen('php://stdin', 'r'); |
| 11 | while(!feof($in)) { |
| 12 | $url = trim(fgets($in)); //echo($url); //Debug |
| 13 | $page = @file($url); |
| 14 | if(!$page) continue; |
| 15 | foreach($page as $line) { |
| 16 | if(!eregi('(mailto:|@)', $line)) continue; |
| 17 | $line = spliti('mailto:', $line); |
| 18 | array_shift($line); |
| 19 | foreach($line as $mail) { |
| 20 | $mail = spliti('(<|>| |\?|")', htmlspecialchars_decode($mail)); |
| 21 | echo(trim($mail[0])."\n"); |
| 22 | } |
| 23 | } |
| 24 | } |