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 !!!
- $ Curl = curl_init ();
- Curl_setopt ($ curl, CURLOPT_URL, 'http: // www. acfun. TV/vote/getVoteReport. aspx? VoteId = 3 ');
- // Set the header
- Curl_setopt ($ curl, CURLOPT_HEADER, 1 );
- // Set the cURL parameter to save the result to the string or output to the screen.
- Curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 );
- // Run cURL to request the webpage
- $ Data = curl_exec ($ curl );
- // Close the 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 'others: '. $ other;
|