在模拟登录的时候,密码是加密提交的,分析js后得知,填写用户名之后客户端通过ajax向服务器获取json,再将请求到的数据和密码一起进行加密,于是想先获取json,但是模拟请求却返回405错误
如下:
HTTP/1.1 100 Continue HTTP/1.1 405 Method Not Allowed Date: Wed, 29 Jun 2016 12:51:25 GMT Transfer-Encoding: chunked Connection: keep-alive Server: nginx/1.8.0 Pragma: No-cache Cache-Control: no-cache Expires: Thu, 01 Jan 1970 00:00:00 GMT Allow: GET但是客户端请求的方法的确是POST,而且头信息我全都模拟了
研究3天了都没搞定。。有木有大神来帮看看什么原因,登录地址:http://v.laifeng.com/login/init?init=login
请求加密json地址:http://v.laifeng.com/login/init?init=login(GET方法404)

解决方案 »

  1.   

    经过测试http://v.laifeng.com/captcha/isneed 只要是POST访问都是能正常返回的URL http://v.laifeng.com/captcha/isneed    post  userName=1231311    无需网页头
      

  2.   

    模拟一下访问来源试试
    CURLOPT_USERAGENT
      

  3.   

    function post()
    {
    $postdata = array('userName'=>"13246511");
    $ch_post = curl_init();
    curl_setopt($ch_post,CURLOPT_URL,"http://v.laifeng.com/captcha/isneed");
    curl_setopt($ch_post,CURLOPT_HEADER,0);
    curl_setopt($ch_post,CURLOPT_POST, 1); // 设置为post;
    curl_setopt($ch_post,CURLOPT_POSTFIELDS,$postdata);//提交数据
    curl_exec($ch_post);
    curl_close($ch_post);
    }
      

  4.   

    405 Method Not Allowed 像上面说的 改用POST