Connect to URL and dump webpage in Groovy

独自空忆成欢 提交于 2019-11-27 01:45:36

问题


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?


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



回答2:


here is a variation

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


来源:https://stackoverflow.com/questions/943873/connect-to-url-and-dump-webpage-in-groovy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!