myHTMLlogin
myHTMLlogin

Reputation:

Connect to URL and dump webpage in Groovy

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?

Upvotes: 46

Views: 52268

Answers (2)

Mark Sailes
Mark Sailes

Reputation: 1254

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

Upvotes: 64

danb
danb

Reputation: 10379

here is a variation

println 'http://www.google.com'.toURL().text

Upvotes: 92

Related Questions