AVFUN Tofu Nao Sweet Party Salty Party Data Statistics
Release: 2016-07-25 08:50:44
Original
1257 people have browsed it
ACFUN has a special topic: http://www.acfun.tv/a/ac715346 Is data refresh using AJAX? Then grab it I don’t know how to use CURL, so I grabbed the interception directly, and then added curly brackets to the bottom Sweet and salty were reversed at first, so $tian is actually salty data $xian is actually sweet data
By the way~ Tofu must be salty! ! !
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, 'http://www.acfun.tv/vote/getVoteReport.aspx?voteId=3');
- / / Set header
- curl_setopt($curl, CURLOPT_HEADER, 1);
-
- // Set cURL parameters to require the result to be saved in a string or output to the screen.
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
-
- // Run cURL and request the web page
- $data = curl_exec($curl);
-
- // Close URL request
- curl_close($curl);
-
- //var_dump( $data);
- //echo $data;
- $nw = explode('{', $data);
- $json = '{'.$nw[1];
- $xian = 0;
- $tian = 0;
- $other = 0;
-
- $de_json = json_decode($json);
- //var_dump($de_json);
- //echo '';
- for ($i=1; $i <= 34; $i++) {
- foreach ($de_json as $key => $value) {
- if ($key == 'count_'.$i.'_1') {
- $xian += $value ;
- }
- if ($key == 'count_'.$i.'_2') {
- $tian += $value;
- }
- if ($key == 'count_'.$i.'_3') {
- $other += $value;
- }
- }
- }
- echo 'Salty Party:'.$tian;
- echo '';
- echo 'Sweet Party:'.$xian;
- echo ' ';
- echo 'Other:'.$other;
Copy code
|
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31