title: Setting "User-Agent" parameters for URLConnection for querying Google from a Java application
body: <p>I am trying to get the results back from a Google query, in Java as follows:</p>
  
  <pre><code>String urlquery = "https://www.google.com/search?hl=en&amp;gl=us&amp;tbm=nws&amp;q=apples&amp;oq=apples";
  URL url = new URL(urlquery);
  URLConnection connection = url.openConnection();
  URLConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5");
  </code></pre>
  
  <p>But, I don't know how to set the "User-Agent" parameters above. From where do I get the values for my system? I just copied these values from some code I found online.</p>
  
  <p>My system configuration is as follows:
  Mac OSX 10.8.3
  Intel i7
  Safari 6.0.3(8536.28.10)</p>