Use PHP crawl Baidu post-mail data

Source: Internet
Author: User

Note: This program may be very suitable for those who do Baidu post-marketing friends.

To visit Baidu Bar when, often see the landlord to share some resources, request to leave the mailbox, the landlord just give hair.

For a popular post, the number of mailboxes left is very much, the landlord needs a copy of those replies to the mailbox, and then paste to send mail, not tortured to death is to be exhausted. Bored to write a crawl Baidu post-mail data procedures, need to take away.

Program implementation of a key crawl post all mailbox and paging crawl mailbox two functions, the interface is too lazy to do, the effect is as follows:

The same as the usual, directly paste source

<?PHP$url 2="";$page="";if($_get[' Url2 ']== ' ""){    $url 2= "Http://tieba.baidu.com/p/2314539885?pn=1";}Else{    $url 2=$_get[' Url2 '];}if($_get[' Page ']== ' "){    $page= "1";}Else{    $page=$_get[' Page '];}><form action= "" method= "get" ><input type= "hidden" value= "GetAll" name= "type"/><table> <tr&        Gt <td> Post Link: </td><td><input type= "text" name= "url" value= "http://tieba.baidu.com/p/2314539885" Style= "width:300px;"/></td> </tr> <tr> <td> Total pages: </td><td><input Typ E= "text" name= "page" style= "width:300px; value=" <?php Echo$page;? > "/></td> </tr> <tr> <td colspan=2><input type=" Submit "value=" Crawl all mailbox Data "/& gt;</td> </tr></table></form><form action= "" method= "get" ><input type= "hidden" Value= "Getnow" name= "type"/><table> <tr> <td> Post link: </td><td><input type= "Tex T "name=" URL2 "value=" <?php Echo$url 2;? > "style=" width:300px; "/></td> </tr> <tr> <td colspan=2><input type=" Submit "Value=" Crawl the current page mailbox data "/></td> </tr></table></form><?PHPif($_get[' Type ']!= ""){    $counts=0; if($_get[' type ']== ' GetAll '){        $pages=$_get[' Page ']; $url=$_get[' URL '];  for($i= 0;$i<$pages;$i++){            $ch 2=Curl_init (); curl_setopt ($ch 2, Curlopt_url,$url); curl_setopt ($ch 2, Curlopt_followlocation,TRUE); curl_setopt ($ch 2, Curlopt_ssl_verifyhost,FALSE); curl_setopt ($ch 2, Curlopt_ssl_verifypeer,false); curl_setopt ($ch 2, Curlopt_returntransfer,TRUE); $texts= Curl_exec ($ch 2); Curl_close ($ch 2); $dat=getemail ($texts);  for($j= 0;$j<Count($dat);$j++){                Echo $dat[$j]." <br/> "; $counts++; }        }    }Else if($_get[' type ']== ' Getnow '){        $url=$_get[' Url2 ']; $ch 2=Curl_init (); curl_setopt ($ch 2, Curlopt_url,$url); curl_setopt ($ch 2, Curlopt_followlocation,TRUE); curl_setopt ($ch 2, Curlopt_ssl_verifyhost,FALSE); curl_setopt ($ch 2, Curlopt_ssl_verifypeer,false); curl_setopt ($ch 2, Curlopt_returntransfer,TRUE); $texts= Curl_exec ($ch 2); Curl_close ($ch 2); $dat=getemail ($texts);  for($i= 0;$i<Count($dat);$i++){            Echo $dat[$i]." <br/> "; $counts++; }    }    Echo' $counts.‘ Bar ;}functionGetemail ($str){    $pattern= "/([a-z0-9\-_\.] [Email protected] [A-z0-9]+\. [A-z0-9\-_\.] +)/"; Preg_match_all($pattern,$str,$EMAILARR); return $EMAILARR[0]; }?>

Use PHP crawl Baidu post-mail data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.