title: Cannot make a cURL request through a proxy in PHP
body: <p>I am trying to make a cURL request through a proxy in PHP but the page never loads. If I use the same proxy via shell commands it works perfectly and I get the response. Here's the code on PHP:</p>
  
  <pre><code> $url = "https://example.com"
   $myvars = "key1=value1&amp;key2=value2;
  
   $ch = curl_init( $url );
  
   curl_setopt($ch, CURLOPT_PROXY, '172.93.148.247');
   curl_setopt($ch, CURLOPT_PROXYPORT, '3128');
  
   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'Content-Type: application/x-www-form-urlencoded; charset=utf-8' 
  ));
   curl_setopt( $ch, CURLOPT_POST, 1);
   curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
   curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1);
   curl_setopt($ch, CURLOPT_VERBOSE, true);
   curl_setopt( $ch, CURLOPT_HEADER, 0);
   curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
  </code></pre>
  
  <p>Shell command (works): </p>
  
  <pre><code>curl --proxy 172.93.148.247:3128 -v -X POST 'https://example.com' -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' -H 'Cookie:' -d "key1=value1&amp;key2=value2"
  </code></pre>