如何让应用程序访问网站以从中获取信息? [英] How can I make an application access a website to get information from it ?

查看:78
本文介绍了如何让应用程序访问网站以从中获取信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在C#中创建一个能够访问网站并从中提取所需信息的应用程序。



我是新手,所以请帮助任何人。 ..



谢谢

解决方案

其他人可用的数据网站。

对于使用/访问其他网站的数据,您只能选择屏幕报废。此外,您需要确保该网站允许捕获/复制数据,否则可能存在法律问题。



对于页面报废,请看一下:

MSDN:带示例的WebRequest类详细信息 [ ^ ]



其他样品:

CP虚荣 [ ^ ]

代码项目论坛分析器:了解你没有多少生命! [ ^ ]


ÿ你绝对可以。这是一种称为 Web抓取的技术: http://en.wikipedia.org/wiki/Web_scraping [ ^ ]。



您需要使用类 System.Net.HttpWebRequest ,对于最简单的情况,您可以使用类 System。 Net.WebClient 。然后,您可能需要一些东西来解析获得的HTML内容。详情请见我过去的答案:

从网页获取特定数据 [ ^ ],

如何从其他网站获取数据 [ ^ ]。



- SA

I want to make an application in C# that is capable of accessing a website and extract the required information from it.

I am new so please help anybody...

Thanks

解决方案

the data which is available on someone else''s website.
For using/accessing data from someone else website, you only have an option of screen scrapping. Further, you need to make sure capturing/copying data is allowed by that website or else there might be a legal issue.

For page scrapping, have a look at this:
MSDN: WebRequest Class details with sample[^]

Other Samples:
CP Vanity[^]
The Code Project Forum Analyzer : Find out how much of a life you don''t have![^]


Yes you can, absolutely. This is the technique of something called Web scraping: http://en.wikipedia.org/wiki/Web_scraping[^].

You need to use the class System.Net.HttpWebRequest, for simplest cases you could you the class System.Net.WebClient. And then you may need something to parse obtained HTML content. For further detail, please see my past answers:
get specific data from web page[^],
How to get the data from another site[^].

—SA


这篇关于如何让应用程序访问网站以从中获取信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆