$file_path ['dirname']
是否有写权限?

解决方案 »

  1.   

    肯定有的。。试了几个站 就这个站保存不了cookie
    头文件返回Connection: close  不知是什么意思
      

  2.   

    HTTP/1.1 200 OK
    Connection: close
    Date: Sat, 05 Jul 2014 04:19:54 GMT
    Server: Microsoft-IIS/6.0
    X-UA-Compatible: IE=EmulateIE7
    X-Powered-By: ASP.NET
    X-Powered-By: PHP/5.2.17
    Content-Type:text/html;charset=utf-8
      

  3.   

    测试一下$url = 'http://www.go9go.cn/member/login.php';
    print_r(get_headers($url));
    $url = 'http://www.go9go.cn/';
    print_r(get_headers($url));
    得Array
    (
        [0] => HTTP/1.1 200 OK
        [1] => Connection: close
        [2] => Date: Sat, 05 Jul 2014 05:02:38 GMT
        [3] => Server: Microsoft-IIS/6.0
        [4] => X-UA-Compatible: IE=EmulateIE7
        [5] => X-Powered-By: ASP.NET
        [6] => X-Powered-By: PHP/5.2.17
        [7] => Content-Type:text/html;charset=utf-8
    )
    Array
    (
        [0] => HTTP/1.1 200 OK
        [1] => Refresh: 30; URL=http://www.go9go.cn/
        [2] => Content-Type: text/html
        [3] => Connection: close
        [4] => Expires: 0
        [5] => Cache-control: no-store,no-cache,must-revalidate,post-check=0,pre-check=0
    )可知两个 url 都没有主动设置 cookie
    所以 cookie 应由 http://www.go9go.cn/member/login.php 的目标页设置的即便是其中有一个设置了 cookie,而你没有
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
    所以
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
    得到的 cookie 也不会发送回去
      

  4.   

    curl_tms('http://www.go9go.cn/member/login.php');
    抓这个页面还是没有生成cookie啊
      

  5.   

    http://www.go9go.cn/member/login.php 只是在登录成功时才会有 cookie 设置
    你没有登录,自然也就得不到 cookie
      

  6.   

    就是登陆获取不到cookie  我才先这样测试。其他站都测试成功了