title: cURL request using socks5 proxy fails when using PHP, but it works through the command line
body: <p>cURL + proxy noob here, having a hard time. I'm having trouble trying to retrieve a web page from a remote secure server via a proxy. Everything has apparently been set up correctly by a remote dev, such that the following command line instruction works and returns what we're looking for:</p>
  
  <pre><code>curl -k --socks5-hostname localhost:xxxx https://hostname/
  </code></pre>
  
  <p>However, the following PHP does not echo the requested webpage. Instead it echoes the error 'Couldn't resolve host name':</p>
  
  <pre><code>$proxy = 'localhost:xxxx';
  $url = 'https://hostname/';
  //$proxyauth = 'user:password';
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_PROXY, $proxy);
  curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
  //curl_setopt($ch, CURLOPT_PROXYUSERPWD, $proxyauth);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_HEADER, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  curl_setopt($ch, CURLOPT_URL, $url);
  $curl_scraped_page = curl_exec($ch);
  $error = curl_error($ch);
  curl_close($ch);
  
  if ($error)
      echo $error;
  elseif ($curl_scraped_page)
      echo $curl_scraped_page;
  </code></pre>
  
  <p>If the $url is changed to a public page, such as Google, the request is successful and everyone is happy.</p>
  
  <p>The connection requires an SSH tunnel if that changes anything at all. The tunnel is open and functioning, as proven by the command line request succeeding.</p>
  
  <p>Is there something obvious that is being missed here?</p>