title: Why does my socks5 speed measure with usage of PHP and cURL not work?
body: <p>I want to measure the speed of a socks5 server via PHP so I wrote the following code:</p>
  
  <pre><code>$url = 'http://cachefly.cachefly.net/1mb.test';
  $proxy = '126.XXX.XXX.XXX:1080’;
  //$auth  = $username.':'.$password;
  
  $fp = fopen('1mb.test', 'w');
  
  $start = microtime(true);
  
  $ch = curl_init();
  
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_PROXY, $proxy);
  curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
  //curl_setopt($ch, CURLOPT_PROXYUSERPWD, $auth);
  
  $result = curl_exec($ch);
  
  curl_close($ch);
  
  $end = microtime(true);
  
  fclose($fp);
  
  $diff = $end - $start;
  echo "elapsed time: ".$diff." seconds";
  
  $a = 1024 / $diff;
  echo '&lt;br&gt;'.floor($a).' kb/s';
  </code></pre>
  
  <p>Unfortunately the code is not working. Without the usage of a socks5 server the file gets downloaded completely - otherwise not. Does anybody of you know why the code isn't working? Are there any alternatives or suggestions on how I can accomplish my goal?</p>
  
  <p>Sincerely, Said.</p>