Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

14
  • Thanks paul, I'm trying it now Commented Jan 16, 2012 at 18:01
  • sorry if I'm noob, the setting up of the user agent header, which part are u referring to? Commented Jan 16, 2012 at 18:16
  • Put System.setProperty("http.agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7"); in a line or two before if (hour==1) { Commented Jan 16, 2012 at 18:19
  • oh no, it still didn't work...could I space my modified code here? Commented Jan 16, 2012 at 18:25
  • System.setProperty("http.agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7"); if (hour==2) { try { URL tariff = new URL("emcsg.com/MarketData/…); java.net.URLConnection c = tariff.openConnection(); c.setRequestProperty("User-Agent", " Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7 "); Commented Jan 16, 2012 at 18:28