Capture the data code of Baidu Post Bar via PHP Web page capture and share with php

Source: Internet
Author: User

Capture the data code of Baidu Post Bar via PHP Web page capture and share with php

Baidu Post Bar is visited frequently. When you visit Baidu post bar, you will often see the owner share some resources and ask for an email to be sent by the owner.

For a hot post, the number of mailboxes left is very large. The landlord needs to copy the reply mailboxes one by one and then paste and send the emails, either suffering or exhausting. It is boring to write a program that captures the mailbox data of Baidu Post Bar and needs to be taken away.

The program implements two functions: one-click capture of all posts mailbox and paging capture of mailbox, the interface is too lazy to do, the effect is as follows:

Old Rules: directly paste the source code

<? Php $ url2 = ""; $ page = ""; if ($ _ GET ['url2 '] = "") {$ url2 = "http://tieba.baidu.com/p/2314539885? Pn = 1 ";}else {$ url2 =$ _ GET ['url2 '];} if ($ _ GET ['page'] = "") {$ page = "1" ;}else {$ page =$ _ GET ['page'] ;}?> <Form action = "" method = "get"> <input type = "hidden" value = "getAll" name = "type"/> <table> <tr> <td> post link: </td> <input type = "text" name = "url" value = "http://tieba.baidu.com/p/2314539885" style = "width: 300px; "/> </td> </tr> <td> total number of pages: </td> <input type = "text" name = "page" style = "width: 300px;" value = "<? Php echo $ page;?> "/> </Td> </tr> <td colspan = 2> <input type =" submit "value =" capture all mailbox data "/> </td> </tr> </table> </form> <form action = "" method = "get"> <input type = "hidden" value = "getNow" name =" type "/> <table> <tr> <td> post link: </td> <input type = "text" name = "url2" value = "<? Php echo $ url2;?> "Style =" width: 300px; "/> </td> </tr> <td colspan = 2> <input type =" submit "value =" Capture email data on the current page "/> </ 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 ++) {$ ch2 = curl_init (); curl_setopt ($ ch2, CURLOPT_URL, $ url); curl_setopt ($ ch2, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ ch2, success, FALSE); curl_setopt ($ ch2, success, FALSE, false); curl_setopt ($ ch2, CURLOPT_RETURNTRANSFER, TRUE); $ texts = curl_exec ($ ch2); curl_close ($ ch2 ); $ Dat = getEmail ($ texts); for ($ j = 0; $ j <count ($ dat); $ j ++) {echo $ dat [$ j]. "<br/>"; $ counts ++ ;}} else if ($ _ GET ['type'] = "getNow ") {$ url = $ _ GET ['url2 ']; $ ch2 = curl_init (); curl_setopt ($ ch2, CURLOPT_URL, $ url); curl_setopt ($ ch2, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt ($ ch2, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt ($ ch2, success, false); curl_setopt ($ ch2, CURLOPT_RETURNTRANSFER, TRUE); $ texts = Curl_exec ($ ch2); curl_close ($ ch2); $ dat = getEmail ($ texts); for ($ I = 0; $ I <count ($ dat ); $ I ++) {echo $ dat [$ I]. "<br/>"; $ counts ++ ;}} echo '

Articles you may be interested in:
  • Code sharing for crawling Baidu Post bars with no basic writing python Crawlers
  • Crawlers of zero-basic writing python crawlers crawl Baidu posts and store them to local txt file Ultimate Edition

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.