简体   繁体   English

使用C#从网站读取数据

[英]Reading data from Website using C#

I have a website named: 我有一个网站名为:

string url="http://180.92.171.80/ffs/data-flow-list-based/flood-forecasted-site/"

When I give the station name, River name, Basin name, It returns me present Water level. 当我给出站名,河流名,流域名时,它会返回我当前的水位。 I want to do it in C#. 我想用C#来做。 I can read HTML code from C# . 我可以从C#读取HTML代码。 But there is no value in HTML. 但是HTML没有任何价值。 Where to start or how I can do it easily? 从哪里开始或如何轻松实现? Anyone have any idea? 有人知道吗

Check out the WebClient class. 签出WebClient类。 You can use the DownloadString() method to get the html from your url as a string. 您可以使用DownloadString()方法从URL中获取HTML作为字符串。

WebClient client = new WebClient ();
string reply = client.DownloadString (address);

http://msdn.microsoft.com/en-us/library/fhd1f0sw.aspx http://msdn.microsoft.com/en-us/library/fhd1f0sw.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM