PHP使用CURL实现对带有验证码的网站进行模拟登录的方法

'18789866111','password'=>'123456','verify'=>$code]);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HEADER,0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_COOKIEFILE, $cookie_file);
$result=curl_exec($curl);
curl_close($curl);
//print_r($result);
$result=json_decode($result,true);

if(substr_count($result['msg'],"登录成功"))
{echo "登录成功\n";}
else{echo "登录失败\n";
exit;
}
?>

你可能感兴趣的:(php,php,开发语言,安全)