开发者

Convert Unix command to run in C# windows form

How do you download a file from a url with p开发者_如何学运维arams like the one below where it is parsing out url links

Unix equivalent command would be

    curl http://URL | perl -nle 'print "$2" if /(<a href=.*usage\/(.*)">.*<\/a>)/'>project_list.txt

This needs to be run from a C# windows form, please be specific as to what code this takes.


You need to call new WebClient().DownloadString() to get the page source, then use the HTML Agility Pack to parse it.


Use the WebClient class to download the html file. Then use regular expressions or LINQ to XML if the page is well formatted to parse out the links.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜