連接到URL並在Groovy中轉儲網頁

[英]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.

我想從groovy打開一個網頁,轉儲指定的網頁,最終將網頁轉儲到錨標簽后面。

Does anybody has some sample code for this?

有人為此提供了一些示例代碼嗎?

2 个解决方案

#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://www.itdaan.com/blog/2009/06/03/72587adc7b07b8ad497496853132a132.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com