|
项目描述: |
This program was inspired by httptest and another article I did, DNSWatch. In that article, I was looking for DNS names being looked up by browsers. In this program, I retrieve a Web page, display it, and list the hosts referenced in it. There are a lot of diferences in Web pages, especially in how to terminate a line and delineate embedded URLs. There are four main routines. GetHostAndPath is an interesting one. It uses the Uri class (uniform resource identifier) to break out the host and path. GetWebPage is the actual network code, copied from an example and slightly modified. There are several ways to do this send and receive; I just chose this one. GetHosts searches the retrieved page for hosts referenced in it. ChangeLfToCrLf is needed because of how different Web pages are terminated in various ways.
这个程序源于httptest 和我写的其它文章,DNSWatch。在那篇文章中我查找可以被浏览器查询的DNS名字。在这个程序中,我检索一个Web页面,显示它,列出它引用的主机。在Web页面中有许多不同,尤其是如何终止一行和判断嵌入的URL。有四个主要的函数。GetHostAndPath很有趣,它使用Uri类(uniform resource identifier)来断开主机名和路径。GetWebPage 实际上是网络代码,从一个例子复制而来,经过了一些修改。有几种方法可以发送和接收;我只是选择了这一种。GetHosts在取回的页面中搜索引用的主机。ChangeLfToCrLf 用于解决不同的Web页面使用不同的结束符这一问题。
来源: http://www.codeguru.com/cs_network/WebPageGet.html |
类别: |
|
发布者:
cbd002
|
|
最新发布源码包 |
软件包 |
版本号 |
日期 |
本地下载 |
WebPageGet |
 1.0  |
2004-04-16 |
下载 |
|
|