举个例子,我想获得某个网站  http://xxxx.xxx.xx/down.asp?id=xxx 网站最后指向的地址,请问我该如何做啊!谢谢高手指点

解决方案 »

  1.   

    你可以用InternetOpen自己下载……
      

  2.   

    怎么没人理我,那我把问题在说一遍
    也就是说我想获得网页 http://xxxx.xxx.xx/down.asp?id=xxx 的重定向地址!
      

  3.   

    具体实现稍为复杂,下面给你原理访问一个网页,就是发送一个Http请求,用Winsocket发,什么叫http请求呢,就是类似下面的:
    GET / HTTP/1.1
    Host: www.csdn.net
    Accept: */*
    Referer: http://down.shd.com.cn/
    Cookie: bblastvisit=1114011311; bblastactivity=1114011311
    User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
    Pragma: no-cache
    Cache-Control: no-cache
    Connection: close这样服务器会给您返回数据,正常的是http 200 HTTP/1.0 200 OK
    Server: Microsoft-IIS/5.0
    X-Powered-By: ASP.NET
    Content-Location: http://www.csdn.net/index.htm
    Date: Mon, 26 Dec 2005 09:56:49 GMT
    Content-Type: text/html
    Accept-Ranges: bytes
    Last-Modified: Mon, 26 Dec 2005 09:50:07 GMT
    ETag: "f818fc11ac61:911"
    Content-Length: 118894
    X-Cache: MISS from cachebj244.csdn.net
    Connection: close如果有转移,服务器就不会发http 200 给你了,就会发Http 302给你通过判断服务器返回给你的是不是http 302 来判断是不是转移了.还要其他一些常见的返回:
    200 正常
    302 转移
    404 没有发现
    403 拒绝访问
    具体你参考一下Http的协议