title: How to access to web page using Groovy?
body: <p>i try to connect to webpage using Groovy,</p>
  
  <p>i tried this, it works when the URL is <code>www.google.fr</code></p>
  
  <pre><code>String.metaClass.browse {
  def handler = [(~/^Mac OS.*/)  : { "open $it".execute() }, (~/^Windows.*/) : { "cmd /C start $it".execute() },
  (~/.*/)         : {
  //--- assume Unix or Linux                        
  def browsers = [ 'firefox'.'chrome' ]
  //--- find a browser we know the location of
  def browser = browsers.find {
  "which $it".execute().waitFor() == 0
  }
  //--- and run it if one found
  if( browser )
  "$browser $it".execute()
  }
  ]
  def k = handler.find { k, v -&gt; k.matcher( System.properties.'os.name' ).matches() }
  k?.value( delegate )
  }
  www.google.fr".browse.()
  </code></pre>
  
  <p>if i put URL which download a file it throw Compilation error. Thank you for your help.</p>