Guest User

Untitled

a guest
Jun 9th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. hf ~/bitfunder | php -f amc.php| less
  2. hf ~/bitfunder | cat amc.php
  3.  
  4. <?php
  5. include('simple_html_dom.php');
  6. $html = file_get_html('https://bitfunder.com/assetlist');
  7.  
  8. $items = array();
  9. $sum = 0;
  10. $number = 0;
  11.  
  12. foreach($html->find('tr') as $line) {
  13.     if(is_object($line)) {
  14.         $item = array();
  15.         $item['asset']   = $line->find('td', 0)->plaintext;
  16.         $item['number']  = str_replace(',', '', $line->find('td', 1)->plaintext);
  17.         $item['address'] = $line->find('td', 2)->plaintext;
  18.         if($item['asset'] === 'AMC') {
  19.             $sum = $sum + $item['number'];
  20.             $number++;
  21.             $items[] = $item;
  22.         }
  23.     }
  24. }
  25.  
  26. array_multisort($items, SORT_DESC);
  27.  
  28.  
  29. for($x = 12; $x > 0; $x--) {
  30.     if($x == 10) {
  31.         echo "----------\n";
  32.     }
  33.     echo number_format($items[12-$x]['number'], 0, '', ',')."\n";
  34. }
  35.  
  36. echo "\nShares sold:\t\t".number_format($sum, 0, '', ',')."\n";
  37. echo "Shareholder count:\t".number_format($number, 0, '', ',')."\n\n";
  38.  
  39. echo "Full recap:\n";
  40.  
  41. foreach($items as $i) {
  42.     echo number_format($i['number'], 0, '', ',')."\n";
  43. }
Advertisement
Add Comment
Please, Sign In to add comment