43

I would like to open a webpage from groovy, dump the specified webpage and eventually dump the webpage behind an anchor tag.

Does anybody has some sample code for this?

2 Answers2

89

here is a variation

println 'http://www.google.com'.toURL().text
danb
  • 10,239
  • 14
  • 60
  • 76
61

This is a good example

http://docs.codehaus.org/display/GROOVY/Simple+file+download+from+URL

Basically you want to do something like

def data = new URL(feedUrl).getText()
Behe
  • 7,572
  • 3
  • 33
  • 46
Mark Sailes
  • 1,224
  • 15
  • 17