PHP How to crawl the email address in the Web page, I will share with you a PHP crawl Web page in the e-mail instance.
?
1 2 3 4 5 6 7 8 9 10 11 12-13 |
<?php $url = ' http://www.3lian.net '; The URL to be collected $content =file_get_contents ($url); Echo $content; function Getemail ($STR) {//$pattern = '/([A-z0-9]*[-_.]? [a-z0-9]+) *@ ([a-z0-9]*[-_]?[ a-z0-9]+) +[.] [A-z] {2,3} ([.] [A-z] {2})? /I "; $pattern = "/([A-z0-9-_.] +@[a-z0-9]+. [A-z0-9-_.] +)/"; Preg_match_all ($pattern, $str, $EMAILARR); return $EMAILARR [0]; Print_r (Getemail ($content));?> |
Method 2:
?
1 2 3 4 5 6 7 8 9 10 |
<?php $url = ' http://www.j3lian.net '; When the page has left the mailbox $content =file_get_contents ($url); Get page content function Getemail ($STR) {//matching mailbox Content $pattern = "/([A-z0-9-_.] +@[a-z0-9]+. [A-z0-9-_.] +)/"; Preg_match_all ($pattern, $str, $EMAILARR); return $EMAILARR [0]; Print_r (Getemail ($content));?> |
The above mentioned is the entire content of this article, I hope you can enjoy.