Open source China personal account information capture instance

Source: Internet
Author: User
Open source China personal account information capture instance, code for reference, simple improvement, can quickly make a command line to manage their own account tools.
Examples use Snoopy,simple_html_dom packages, which can be downloaded directly from open source China ....

  1. Need to call into PHP package, retrieve download from Oschina can
  2. Include "Snoopy.class.php"; Crawl Web page information, support through the HTTP code way,
  3. Include "simple_html_dom.php"; HTML Analysis Package
  4. $snoopy = new Snoopy;
  5. $snoopy->proxy_host= "# # #";
  6. $snoopy->proxy_port= "8888";
  7. $snoopy->user= "* * *";
  8. $snoopy->pass= "* * *";
  9. $snoopy->agent = "(mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:24.0) gecko/20131117 firefox/24.0 palemoon/24.1.2) ";
  10. $snoopy->referer = "http://www.oschina.net/";
  11. $snoopy->cookies["oscid"] = ' ****** ';
  12. $snoopy->fetch ("Https://www.oschina.net/home/login?goto_page=http%3A%2F%2Fwww.oschina.net%2F");
  13. Authentication requires authentication to get access to data
  14. $submit _url = "Http://www.oschina.net/action/user/hash_login";
  15. $submit _vars["Email" = "* * * * *";
  16. $submit _vars["pwd"] = SHA1 ("*******");
  17. $submit _vars["Save_login"] = 1;
  18. $submit _vars["submit"] = "Login Now";
  19. $snoopy->submit ($submit _url, $submit _vars);
  20. echo "Certification status \ n";
  21. Print $snoopy->results;
  22. After the certification is passed, get the data
  23. $snoopy->fetch ("Http://my.oschina.net/******/admin/inbox");
  24. echo "Open source China personal account Information test program \ n";
  25. echo "Time:". Date ("Y-m-d h:i:s"). " \ n ";
  26. Echo iconv ("UTF-8", "Gbk//ignore", $snoopy->results);
  27. $result = $snoopy->results;
  28. Print $result;
  29. Simple_html_dom explaining package usage instances
  30. $SHTML =new simple_html_dom ();
  31. $html = str_get_html ($result);
  32. $messS = $html->find (' ul. Msgs Li[id] ');
  33. foreach ($messS as $mess) {
  34. $aT = $SHTML->load ($mess);
  35. echo "===================\n";
  36. echo $aT. " \ n ";
  37. echo "-----------\ n Below is an analysis of the above HTML information extraction processing: \ n";
  38. echo ' Information ID: '. $aT->find (' li[id] ', 0)->id. " \ n ";
  39. Echo ' info: '. Trim ($aT->find (' div.msg ', 0)->plaintext). " \ n ";
  40. Echo ' Date: '. Trim ($aT->find (' Div.bottom span.date ', 0)->plaintext). ' '." \ n ";
  41. Print ("===================\n");
  42. }
Copy Code
  • 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.