MrPaan

class.speedtest.php

May 24th, 2014
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.57 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  
  5. Server List :
  6.  
  7. Penang = 473
  8. Kuala Lumpur = 1899
  9. Singapore = 367
  10. Seri Kembangan = 1265
  11. Cyberjaya = 1610
  12. Bandar Seri Begawan = 1618
  13. Jakarta = 880
  14.  
  15. */
  16.  
  17. class speedtest {
  18.      
  19.          private $down;
  20.          private $up;
  21.          private $pingay;
  22.          private $server;
  23.          public $hash;
  24.          public $headers;
  25.          public $post;
  26.          public $kudud;
  27.          public $dud;
  28.          public $ch;
  29.          public $accuracy;
  30.  
  31.  
  32. public function setDown($down) {
  33.      
  34.          $this -> down = $down;
  35.          
  36.          }
  37.  
  38. public function setUp($up) {
  39.      
  40.          $this -> up = $up;
  41.          
  42.          }
  43.  
  44. public function setPing($pingay) {
  45.      
  46.          $this -> pingay = $pingay;
  47.          
  48.          }
  49.  
  50. public function setServer($server) {
  51.      
  52.          $this -> server = $server;
  53.          
  54.          }
  55.  
  56. public function spoof() {
  57.          
  58.          $hash = md5("{$this->pingay}-{$this->up}-{$this->down}-297aae72");
  59.          
  60.          $headers = Array(
  61.         'POST /api/api.php HTTP/1.1',
  62.         'Host: www.speedtest.net',
  63.         'User-Agent: 0b0x3d',
  64.         'Content-Type: application/x-www-form-urlencoded',
  65.         'Origin: http://c.speedtest.net',
  66.         'Referer: http://c.speedtest.net/flash/speedtest.swf',
  67.         'Cookie: bisjut',
  68.         'Connection: Close'
  69.      );
  70.          $post = "startmode=recommendedselect&promo=&upload={$this->up}&accuracy=8&recommendedserverid={$this->server}&serverid={$this->server}&ping={$this->pingay}&hash={$hash}&download={$this->down}";
  71.      //$post = urlencode($post);
  72.          $ch = curl_init();
  73.      curl_setopt($ch, CURLOPT_URL, 'http://www.speedtest.net/api/api.php');
  74.      curl_setopt($ch, CURLOPT_ENCODING, "" );
  75.      curl_setopt($ch, CURLOPT_POST, 1);
  76.      curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  77.      curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  78.      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  79.      curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
  80.      $kudud = curl_exec($ch);$kudud = curl_exec($ch);
  81.      foreach (explode('&', $kudud) as $dud) {
  82.      $gay = explode("=", $dud);
  83.      if (urldecode($gay[0])== "resultid"){
  84.            echo 'URL : http://www.speedtest.net/my-result/'.urldecode($gay[1]).' <br />';
  85.            echo 'Image : http://www.speedtest.net/result/'.urldecode($gay[1]).'.png';
  86.         }
  87.     }
  88. }
  89.  
  90. }
  91.  
  92. /*
  93.  
  94. Buang tanda komen kalau nak run
  95.  
  96. $spoof = new speedtest();
  97. $spoof -> setDown("10000.999");
  98. $spoof -> setUp("10000.999");
  99. $spoof -> setPing("1");
  100. $spoof -> setServer("473");
  101. $spoof -> spoof();
  102. */
  103.  
  104.  
  105. ?>
Advertisement
Add Comment
Please, Sign In to add comment