php curl模拟登陆 提示404
 $cookie_file = tempnam('./temp','cookie');
        $login_url  = 'http://www.bjgjj.gov.cn/wsyw/wscx/gjjcx-choice.jsp';
        $post_fields = 'lk=1&lb=1&bh=6D2DD1703EC0E3203D0215C56E17448A268CF896B42936D01001A750330C4BF212E54B2F2C0DFCBC&mm=DF3B71987B462DF821588C1B2652FF04&gjjcxjjmyhpppp='.$post['gjjcxjjmyhpppp1'].'&gjjcxjjmyhpppp1='.$post['gjjcxjjmyhpppp'].'&bh1=身份证账号&mm1=密码';
        $ch = curl_init($login_url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
        curl_exec($ch);
        curl_close($ch);

        $url='http://www.bjgjj.gov.cn/wsyw/wscx/gjj_cx.jsp?nicam=ejUyMzIyenk4M3I3enJycjM3cnIzMDcA&hskwe=R0pKd2M1Mnc3YTJ6MTk0&vnv=JiMyMTAxNjsmIzI1MzkxOyYjMjM0Mzk7&lx=0';
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
        $contents = curl_exec($ch);
        var_dump($contents);
        curl_close($ch);

1个回答

你这是要问什么问题么?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐