Guest User

Untitled

a guest
Feb 10th, 2017
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. $id = "ID";
  4. $password = "PASSWORD";
  5.  
  6. $url = "http://top.mail.ru/json/srchlanding?id=$id&action=json&password=$password&pp=50000&rettype=all";
  7.  
  8. $data = json_decode(file_get_contents($url));
  9.  
  10. $domains = [];
  11. $se = [];
  12.  
  13. foreach($data->elements as $hit):
  14.     $domains[$hit->sign][parse_url($hit->url, PHP_URL_HOST)] += $hit->hits;
  15.     $se[$hit->sign] += $hit->hits;
  16. endforeach;
  17.  
  18. foreach($se as $name => $value):
  19.     echo "<h2>$name = $value</h2>";
  20.     echo "<table>";
  21.     foreach($domains[$name] as $domain => $hits):
  22.         echo "<tr><td><i>$domain</i></td><td><b>$hits</b></td></tr>";
  23.     endforeach;
  24.     echo "</table>";
  25. endforeach;
Advertisement
Add Comment
Please, Sign In to add comment