如题,我看MSDN讲Navigate2有个参数:lpszHeaders可以指定要发送到服务器的可选的头信息。
 不知道能不能用这个参数来指定Referer,比如我想指定Referer地址为http://www.budin.cn,那么这个参数应该怎么写,格式是什么?我没找到相关的资料,谢谢大家了

解决方案 »

  1.   

    当然可以
    GET http://www.sina.com.cn HTTP/1.0
    Host: www.sina.com.cn
    prama: no-cache
    Referer: http://www.budin.cn
    Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*
      

  2.   

    不行哦,如是要我把参数设为
    CString Get; Get="GET http://www.sina.com.cn HTTP/1.0 ";
    Get= Get+ "Host: www.sina.com.cn ";
    Get= Get+ "prama: no-cache ";
    Get= Get+ "Referer: http://www.budin.cn ";
    Get= Get+ "Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*";
    Navigate2(_T(site),NULL,NULL,"Referer: http://www.sina.com.cn",NULL,NULL);
    --------------------------
    打不开网页,该页无法显示
      

  3.   

    没有请求! 应该是Navigate2函数没有成功调用,lpszHeaders参数没有设置正确
      

  4.   

    抓包看过了。程序没有请求! 我想应该是Navigate2函数没有成功调用,lpszHeaders参数没有设置正确
      

  5.   

    HTTP/1.1 400 Bad Request..Content-Type: text/html..Date: Tue, 25 Jul 2006 05:05:38 GMT..Connection: close..Content-Length: 42....<h1>Bad Request (Invalid Header Name)</h1>
      

  6.   

    来了:)应该是session的问题,你试试吧
      

  7.   

    GET http://www.sina.com.cn HTTP/1.0
    Host: www.sina.com.cn
    prama: no-cache
    把这几行去掉(程序自动添加的,不需要手动设定),现在能打开网页了,可是Referer: http://www.budin.cn还是没起作用。 抓包看了。和在软件里点击链接只有3处不同:
    1. Get的地址,包里显示的虽然不同但都是首页,访问的页面是一样的
    2. Accept-Encoding: gzip, deflate..Accept-Language: zh-cn..这两个的位置一前一后刚好反过来
    3. cookies的未尾,点击链接多了一段“ASPSESSIONIDASDSCDQA=JNMJJLDCFJEPNOBHDFMFAKNE”------------------------------------------------------------------
    //点击链接的包
    GET /default.html HTTP/1.1..Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/msword, */*..Referer: http://www.budin.cn/..Accept-Language: zh-cn..Accept-Encoding: gzip, deflate..If-Modified-Since: Mon, 24 Jul 2006 15:23:03 GMT..If-None-Match: "881435e35afc61:378"..User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Alexa Toolbar)..Host: www.budin.cn..Connection: Keep-Alive..Cookie: rtime=1; ltime=1152349149875; cnzz_eid=67068422-; Budin=password=82e2a137e1066616&userid=6&usercookies=0&userclass=5&username=%BC%D7%BF%C6%B6%FB%CB%EC&editor=html; rtime=2; ltime=1153812021500; cnzz_eid=67068422-; TZ=0; cnzz02=54; Cookie_itsun=y; is_use_cookie=yes; is_get_108173=yes; ASPSESSIONIDASDSCDQA=JNMJJLDCFJEPNOBHDFMFAKNE....
    //直接输入网址由软件伪造Referer的包GET / HTTP/1.1..Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/msword, */*..Referer: http://www.budin.cn/..Accept-Encoding: gzip, deflate..Accept-Language: zh-cn..If-Modified-Since: Mon, 24 Jul 2006 15:23:03 GMT..If-None-Match: "881435e35afc61:378"..User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Alexa Toolbar)..Host: www.budin.cn..Connection: Keep-Alive..Cookie: rtime=1; ltime=1152349149875; cnzz_eid=67068422-; Budin=password=82e2a137e1066616&userid=6&usercookies=0&userclass=5&username=%BC%D7%BF%C6%B6%FB%CB%EC&editor=html; rtime=2; ltime=1153812142515; cnzz_eid=67068422-; TZ=0; cnzz02=55; Cookie_itsun=y; is_use_cookie=yes; is_get_108173=yes....
      

  8.   

    唉~  我把包都摸拟得非常的像了。可还是不行:////直接输入网址的包GET / HTTP/1.1..Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/msword, */*..Referer: http://www.budin.cn/....Accept-Language: zh-cn..Accept-Encoding: gzip, deflate..If-Modified-Since: Sun, 09 Jul 2006 00:25:16 GMT..If-None-Match: "ccf2b27eea2c61:378"..User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Alexa Toolbar)..Host: www.budin.cn..Connection: Keep-Alive..Cookie: rtime=1; ltime=1152349149875; cnzz_eid=67068422-; Budin=password=82e2a137e1066616&userid=6&usercookies=0&userclass=5&username=%BC%D7%BF%C6%B6%FB%CB%EC&editor=html; rtime=2; ltime=1153833096359; cnzz_eid=67068422-; TZ=0; cnzz02=105; Cookie_itsun=y; is_use_cookie=yes; is_get_108173=yes....
    /////点击链接的包GET / HTTP/1.1..Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/msword, */*..Referer: http://www.budin.cn/..Accept-Language: zh-cn..Accept-Encoding: gzip, deflate..If-Modified-Since: Tue, 25 Jul 2006 11:58:12 GMT..If-None-Match: "a48f59ae1afc61:378"..User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Alexa Toolbar)..Host: www.budin.cn..Connection: Keep-Alive..Cookie: rtime=1; ltime=1152349149875; cnzz_eid=67068422-; Budin=password=82e2a137e1066616&userid=6&usercookies=0&userclass=5&username=%BC%D7%BF%C6%B6%FB%CB%EC&editor=html; rtime=2; ltime=1153832797109; cnzz_eid=67068422-; TZ=0; cnzz02=102; Cookie_itsun=y; is_use_cookie=yes; is_get_108173=yes....
    _____________________________________________我用了   CInternetSession* mySession;    
    CHttpFile* myHttpFile=NULL;
    CHttpConnection* lphttpConnection;   建立Http链接并用OpenURL打开该URL,最后用Navigate浏览网页。 达到以上效果。可是伪造的Referer还是没起效果。 郁闷中....