winform 中请求http连接,如何过去网页中返回的数据呢?
例如下面这个连接
http://www.anttna.com/cell2gps/cell2gps.php?lac=16647&cellid=47122如何接收到41.758526,123.416260, 辽宁省;沈阳市;和平区;沈阳市华研电子有限公司西南20米;东北大学干燥技术研究所东南90米;经典齿科; 这些值?求教
例如下面这个连接
http://www.anttna.com/cell2gps/cell2gps.php?lac=16647&cellid=47122如何接收到41.758526,123.416260, 辽宁省;沈阳市;和平区;沈阳市华研电子有限公司西南20米;东北大学干燥技术研究所东南90米;经典齿科; 这些值?求教
/// <param name="url">远程网页地址URL</param>
/// <returns>成功返回远程HTML的代码内容</returns>
private string GetWebContent(string url)
{
using (WebClient client = new WebClient())
{
byte[] buffer = client.DownloadData(url);
string str = Encoding.GetEncoding("GB2312").GetString(buffer, 0, buffer.Length);
return str;
}
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/llddyy123wq/archive/2010/05/12/5582067.aspx