title: How to use proxy in php curl
body: <p>I have a curl function:</p>
  
  <pre><code>function curl($url, $referer, $type=null){
      $agent = ($type != null &amp;&amp; $type = 'movil') ? 'Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30' : 'Mozilla/5.0(Windows;U;WindowsNT5.0;en-US;rv:1.4)Gecko/20030624Netscape/7.1(ax)';
      $ch = curl_init($url);
      curl_setopt($ch, CURLOPT_USERAGENT, $agent);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_TIMEOUT, 10);
      curl_setopt($ch, CURLOPT_REFERER, $referer);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      $page = curl_exec($ch);
      curl_close($ch);
      return $page;
  }
  </code></pre>
  
  <p>But this function displays my server ip on request so would be great to know any way to use it via proxy ip and port.Thankyou</p>