HTTP/1.1 302 Moved Temporarily Date: Thu, 08 Dec 2005 01:08:46 GMT Server: Oracle-Application-Server-10g/9.0.4.0.0 Oracle-HTTP-Server Set-Cookie: JSESSIONID=ca541159ce83c41b7ce1de84adebf5dfad81ffe6d3e.s6vymBrzmxuIs6zIo7jvpAjO-AbJphCNaN0Ocybtah0Iah0N-x8IahuInh9ymkiT-Anya6aLmA8Qck8I-huKa30xok5Nah1Bq7jwc2TSo6fwrQjwc2TSokTCrk5InleImQXH8N4Pb30Oc3yPbNqxf2bKrk9tnkSxn6jAmljGr5XDqQLvpAe_; Path=/eng Cache-Control: private Location: http://202.84.17.89/sso/authenticatet?serverid=publish&localsessionid=ca541159ce83c41b7ce1de84adebf5dfad81ffe6d3e&requesturl=http%3A%2F%2F202.84.17.88%2Feng%2Findex.jsp%3Flocale%3Deng&action=0 Connection: close Content-Type: text/plain
http以上便是返回信息http://202.84.17.89/sso/authenticatet?serverid=publish&localsessionid=ca541159ce83c41b7ce1de84adebf5dfad81ffe6d3e&requesturl=http%3A%2F%2F202.84.17.88%2Feng%2Findex.jsp%3Flocale%3Deng&action=0
对于这个地址我直接放到浏览器里面就可以正常显示

解决方案 »

  1.   

    302 Moved Temporarily
    通过返回的头可以看出,xinhuanet使用了重定向,关键在于,我如何获取那个重定向后的页面?
    这里,我试图把http://202.84.17.89/sso/authenticatet?serverid=publish&localsessionid=ca541159ce83c41b7ce1de84adebf5dfad81ffe6d3e&requesturl=http%3A%2F%2F202.84.17.88%2Feng%2Findex.jsp%3Flocale%3Deng&action=0
    这个地址放进去
    $response = GetWebContent("202.84.17.89","POST /  /sso/authenticatet?serverid=publish&localsessionid=ca541159ce83c41b7ce1de84adebf5dfad81ffe6d3e&requesturl=http%3A%2F%2F202.84.17.88%2Feng%2Findex.jsp%3Flocale%3Deng&action=0
     HTTP/1.0", $str); 
    可是结果却是构造了一串更长的location出来
      

  2.   

    我想问一下每做一次fsockopen,,是否就等于打开了一个新的窗口去open这个url导致session发生了变化?
      

  3.   

    用fopen ,自 PHP 4.0.5 起支持重定向。如果使用较早版本的 PHP 则需要在 URL 末尾包括一个斜线。如果一定要知道文档所在的资源的 url(在所有重定向被处理过之后),则需要处理从流返回的一系列响应报头信息。 
    <?php
    $url = 'http://www.example.com/redirecting_page.php';$fp = fopen($url, 'r');/* Prior to PHP 4.3.0 use $http_response_header
       instead of stream_get_meta_data() */
    foreach(stream_get_meta_data($fp) as $response) {  /* Were we redirected? */
      if (substr(strtolower($response), 0, 10) == 'location: ') {
        /* update $url with where we were redirected to */
        $url = substr($response, 10);
      }}?>  
    流允许访问资源的正文,报头部分保存在 $http_response_header 变量中。自 PHP 4.3.0 起,可以用 stream_get_meta_data() 得到报头。 或者你把报头里的 Location找出来,再读一次,nettransport就是这样的