登陆一样是post请求,已经是直接用socket了,用户名密码写在头里不行么?

解决方案 »

  1.   

    可以模拟cookie或者你用curl函数库
      

  2.   

    cookie等$host = ";
    $file = "";
    $cookie = '';
    $parames = '';$fp = @fsockopen($host,80,$errno,$errstr,30) or exit($errstr."--->".$errno);
    $header = "POST ".$file." HTTP/1.1\r\n";
    $header .= "Host:$host\r\n";
    $header .= "Referer:$host.$file\r\n";
    $header .= "Content-Length: ".$length."\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n\r\n";
    $header .= $params."\r\n";
    $header .= "Connection: Keep-Alive\r\n\r\n";
    $header .= sprintf("Cookie: %s\r\n\r\n", $cookie);
      

  3.   

    curl更容易实现一些,好像还可以保留会话
      

  4.   

    iasky(iasky)说的方法以前试过不行
    所以想通过直接传cookie的sessionid
    不知道怎么实现
      

  5.   

    使用curl系列函数比较方便
    http://wjjchen.blog.163.com/blog/static/16287222006111935416906/