AVFUN bean curd brain sweet party salty party data statistics

Source: Internet
Author: User
AVFUN bean curd brain sweet party salty party data statistics
ACFUN made a topic: http://www.acfun. TV /a/ac715346
Is data refreshing AJAX ~ Just grab it.
Instead of using CURL, capture the screenshot directly, and add a braces to the following
The sweet party and the salty party are reversed at the beginning, so
$ Tian is actually xiandang data
$ Xian is actually sweet party data

By the way ~ The tofu brain must be salty !!!

  1. $ Curl = curl_init ();
  2. Curl_setopt ($ curl, CURLOPT_URL, 'http: // www. acfun. TV/vote/getVoteReport. aspx? VoteId = 3 ');
  3. // Set the header
  4. Curl_setopt ($ curl, CURLOPT_HEADER, 1 );
  5. // Set the cURL parameter to save the result to the string or output to the screen.
  6. Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 );
  7. // Run cURL to request the webpage
  8. $ Data = curl_exec ($ curl );
  9. // Close the URL request
  10. Curl_close ($ curl );
  11. // Var_dump ($ data );
  12. // Echo $ data;
  13. $ Nw = explode ('{', $ data );
  14. $ Json = '{'. $ nw [1];
  15. $ Xian = 0;
  16. $ Tian = 0;
  17. $ Other = 0;
  18. $ De_json = json_decode ($ json );
  19. // Var_dump ($ de_json );
  20. // Echo'
    ';
  21. For ($ I = 1; $ I <= 34; $ I ++ ){
  22. Foreach ($ de_json as $ key => $ value ){
  23. If ($ key = 'Count _ '. $ I.' _ 1 '){
  24. $ Xian + = $ value;
  25. }
  26. If ($ key = 'Count _ '. $ I.' _ 2 '){
  27. $ Tian + = $ value;
  28. }
  29. If ($ key = 'Count _ '. $ I.' _ 3 '){
  30. $ Other + = $ value;
  31. }
  32. }
  33. }
  34. Echo 'salty party: '. $ tian;
  35. Echo'
    ';
  36. Echo 'Sweet party: '. $ xian;
  37. Echo'
    ';
  38. Echo 'others: '. $ other;

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.