|
我想通过winsock下载网页、文件。但是关于RemoteHost主机名总会出现问题。 例如: With Winsock1 .RemoteHost = "www.sohu.com" .RemotePort = 80 .Connect End With 以上设置程序运行后无错误,网页及图片等链接都可以下载 With Winsock1 .RemoteHost = "www.sina.com.cn" .RemotePort = 80 .Connect End With 但是某些网页如sina,照以上设置,winsock根本不响应 Private Sub Winsock1_Connect()事件。 请指教. 注:如遇到跳转服务器(转链接)的情况时又如何确定服务名。 |
|
|
|
被重定向了吧
|
|
|
我用是可以的,多试验几次。
|
|
|
以下为下载的头信息:
HTTP/1.0 400 Bad Request Server: squid/2.5.STABLE3 Mime-Version: 1.0 Date: Thu, 16 Oct 2003 03:13:02 GMT Content-Type: text/html Content-Length: 1170 Expires: Thu, 16 Oct 2003 03:13:02 GMT X-Squid-Error: ERR_INVALID_URL 0 X-Cache: MISS from sq231.sina.com.cn X-Cache-Lookup: NONE from sq231.sina.com.cn:80 Proxy-Connection: close |
|
|
以下为下载的信息
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>ERROR: The requested URL could not be retrieved</TITLE> <STYLE type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE> </HEAD><BODY> <H1>ERROR</H1> <H2>The requested URL could not be retrieved</H2> <HR noshade size="1px"> <P> While trying to retrieve the URL: <A HREF="www.sina.com.cn">www.sina.com.cn</A> <P> The following error was encountered: <UL> <LI> <STRONG> Invalid URL </STRONG> </UL> <P> Some aspect of the requested URL is incorrect. Possible problems: <UL> <LI>Missing or incorrect access protocol (should be `http://'' or similar) <LI>Missing hostname <LI>Illegal double-escape in the URL-Path <LI>Illegal character in hostname; underscores are not allowed </UL> <P>Your cache administrator is <A HREF="mailto:webmaster">webmaster</A>. <BR clear="all"> <HR noshade size="1px"> <ADDRESS> Generated Thu, 16 Oct 2003 03:12:22 GMT by sq234.sina.com.cn (squid/2.5.STABLE3) </ADDRESS> </BODY></HTML> |
|
|
好像是重定向问题。有没有方法解决??
不能下载: www.sina.com.cn www.263.com 可以下载: www.sohu.com www.yeah.net |
|
|
重定向,或者请求的时候的主机头问题
|
|
|
都可以下载。
是否你的网络环境的问题呢?介绍你的网络环境。 |
|
|
我是通地代理上网的。
代理采用inet共享方式。 我只需要设置网关即可上网。IE设置为默认状态 |
|
|
既然ie不用设置,应该不会有问题呀。。。
|
|
|
唉。算啦。我以放弃改用Inet控件了。
|
|
|
HTTP/1.0 400 Bad Request
Server: squid/2.5.STABLE3 你的请求有问题,然后他的回复上说: <LI>Missing or incorrect access protocol (should be `http://'' or similar) <LI>Missing hostname <LI>Illegal double-escape in the URL-Path <LI>Illegal character in hostname; underscores are not allowed 估计原因是第一种,你的请求没有加协议 连接之后还有许多步骤,建议你去看一下RFC文档,关于HTTP协议 |
|