Connect to URL and dump webpage in Groovy

47,622

Solution 1

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()

Solution 2

here is a variation

println 'http://www.google.com'.toURL().text
Share:
47,622

Related videos on Youtube

Admin
Author by

Admin

Updated on May 05, 2020

Comments

  • Admin
    Admin about 4 years

    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?

  • shabunc
    shabunc over 12 years
    as for me any getter method which actually can have params is handier to call directly. getText('utf-8') cannot be shortcuted.
  • Armand
    Armand almost 11 years
    this getter doesn't have params
  • Piko
    Piko about 5 years
    Love this. When I code in Groovy, I feel guilty since complicated tasks are so simple!