C# winform 请求http

shancheng44 2010-05-22 04:26:51
winform 中请求http连接,如何过去网页中返回的数据呢?


例如下面这个连接
http://www.anttna.com/cell2gps/cell2gps.php?lac=16647&cellid=47122

如何接收到

41.758526,123.416260, 辽宁省;沈阳市;和平区;沈阳市华研电子有限公司西南20米;东北大学干燥技术研究所东南90米;经典齿科;

这些值?求教
...全文
88 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
shancheng44 2010-05-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 llddyy123wq 的回复:]
用WebClient对象
[/Quote]

麻烦给个示例代码,谢谢,实在是时间紧,我手头还有别的工作...
llddyy123wq 2010-05-22
  • 打赏
  • 举报
回复
/// <summary> 获取远程HTML内容</summary>
/// <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
NewUser2008 2010-05-22
  • 打赏
  • 举报
回复
HttpWebRequest
HttpWebResponse
llddyy123wq 2010-05-22
  • 打赏
  • 举报
回复
用WebClient对象
shancheng44 2010-05-22
  • 打赏
  • 举报
回复
ding a `````````````

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧