title: geocode with proxy php
body: <p>I'm new and I'm using maps api to geocode address. In my machine I don't have any problem. The problem is when I have a server with proxy. I tried to configure the proxy using two different functions:</p>
  
  <pre><code>function curl($url)
  {
      $ch = curl_init();
  
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_PROXY, "http://my_proxy"); 
      curl_setopt($ch, CURLOPT_PROXYPORT, my_port); 
  
      curl_setopt($ch, CURLOPT_HEADER,0); //Change this to a 1 to return headers
      curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  
      $data = curl_exec($ch);
      var_dump($data);
      curl_close($ch);
  
      return $data;
  }
  </code></pre>
  
  <p>or </p>
  
  <pre><code>function curl($url)
  {       
      $opts = array('http' =&gt; array('proxy' =&gt; 'tcp://my_proxy', 'request_fulluri' =&gt; true));
      $context = stream_context_create($opts);
  
      $data = file_get_contents($url, false, $context);
  
      return $data;
  }
  </code></pre>
  
  <p>and then I'm calling that function using these lines:</p>
  
  <pre><code>            $address = urlencode($address);
              $data = $this-&gt;curl("http://maps.google.com/maps/api/geocode/xml?address={$address}&amp;sensor=false");
              $lat_lng = simplexml_load_string($data);
  </code></pre>
  
  <p>but I'm getting 'OVER_QUERY_LIMIT' error.</p>
  
  <p>Do you have any idea?
  Thanks.</p>