内容导航:$i++){ $fontsizecolor=imagecolorallocate($image,是个汉字的验证码了 } //干扰点 for ($i=0,//随机颜色 //$color=imagecolorallocate($image,//$color=imagecolorallocate($image
  • php 识别验证码
  • php怎么识别验证码
  • php怎么识别验证码啊
  • php中文验证码无法显示
  • {image}

    一 、php 识别验证码

    PHP识别验证码(适合大部分验证码)
    <?php
    $ch= curl_init();
    $img='@D:\APMServ5.2.6\www\htdocs\ccb\';//注意@,表示文件上传
    $data=array(
    'type'=>'recognize',
    'softID'=>'3',
    'softKey'=>'dac04a0f1',
    'userName'=>'test',
    'passWord'=>'',
    'imagePath'=>戚铅者$img,
    'codeType'=>'1040',//验证码类高薯型 ,见下面图片
    'timeout'=>'60',
    'remark'=>'',
    'log'=>'0',
    'upload'=>'开始识别'
    );
    // $ch =
    curl_init();
    //
    curl_setopt($ch, CURLOPT_URL, $url);
    //
    curl_setopt($ch, CURLOPT_POST, 1);
    //
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    //
    curl_exec($ch);
    //
    curl_close($ch);

    //
    这段代码提交出去的Content-Type到底是multipart/form-data还是application/x-www-form- urlencoded呢?我抓包研究了一下,发现Content-Type的类型取决于$data的数激亮据类型 。

    //
    如果$data是字符串,则Content-Type是application/x-www-form-urlencoded。

    //
    如果$data是k=>v的数组 ,则Content-Type是multipart/form-data
    $url='/ZMDemo_PHP/';
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
    $result=
    curl_exec($ch);
    echo$result;
    curl_close($ch);

    二、php怎么识别验证码

    使用图片验证码,一般注册机很难识别图片上的字符。 图片验证码原理:在注册表单页上,添加一个表单项 ,用于提交用户看到的图片验证码 ,在适合位置放一个识别验证码有手动识别验证码和自动识别验证码,自动识别验证码很便宜的,我一直在用的是挣码网的自动打码 ,上面也有手工远程识别验证码的,就不是免费的,所以你懂得 。

    三、php怎么识别验证码啊

    重点还是在于我们选择发布外链的平台上 ,选择高质量的 、稳定的、权威的外链平台是非常关键的。

    四、php中文验证码无法显示

    匿名用户14 次浏览2015.04.09 提问我来回答提交答案匿名session_start();
    $image=imagecreatetruecolor(200, 60);//创建画布
    $color = imagecolorallocate($image, mt_rand(157,255), mt_rand(157,255), mt_rand(157,255));//随机颜色
    //$color=imagecolorallocate($image, 255, 255, 255);
    imagefill($image, 0, 0, $color);//填充颜色
    //中文验证码
    $fontface="";//确保相同目录下有该字体
    $strdb=array('好','多','人','在','学','习');
    for ($i=0;$i<4;$i++){
    $fontsizecolor=imagecolorallocate($image, mt_rand(0, 150), mt_rand(0, 150), mt_rand(0, 150));
    $codex=iconv("GB2312","UTF-8",$strdb[mt_rand(0,5)]);//iconv不能转数组 取任意下标
    imagettftext($image, mt_rand(20, 24), mt_rand(-30, 30), (40*$i+20), mt_rand(30, 35), $fontsizecolor, $fontface, $codex);//如果用$code的话 就生成 1+2+3+4 是个汉字的验证码了

    }

    //干扰点
    for ($i=0;$i<200;$i++){
    $pointcolor=imagecolorallocate($image, mt_rand(50, 200), mt_rand(50, 200), mt_rand(50, 200));
    imagesetpixel($image, mt_rand(1, 100), mt_rand(1,20), $pointcolor); //雪花
    }
    //干扰线
    for ($i=0;$i<3;$i++){
    $linecolor=imagecolorallocate($image, mt_rand(50, 200), mt_rand(50, 200), mt_rand(50, 200));
    imageline($image, mt_rand(1, 99), mt_rand(1, 99), mt_rand(1, 99), mt_rand(1, 99), $linecolor);
    }
    ob_clean();
    header("Content-type:image/png");
    imagepng($image);
    imagedestroy($image);session_start(); $image=imagecreatetruecolor(200, 60);//创建画布 $color = imagecolorallocate($image, mt_rand(157,255), mt_rand(157,255), mt_rand(157,255));//随机颜色 //$color=imagecolorallocate($image, 255, 255, 255); imagefill($image, 0, 0, $color);//填充颜色 //中文验证码 $fontface="";//确保相同目录下有该字体 $strdb=array('好','多','人','在','学','习'); for ($i=0;$i<4;$i++){ $fontsizecolor=imagecolorallocate($image, mt_rand(0, 150), mt_rand(0, 150), mt_rand(0, 150)); $codex=iconv("gb2312","utf-8",$strdb[mt_rand(0,5)]);//iconv不能转数组 取任意下标 imagettftext($image, mt_rand(20, 24), mt_rand(-30, 30), (40*$i+20), mt_rand(30, 35), $fontsizecolor, $fontface, $codex);//如果用$code的话 就生成 1+2+3+4 是个汉字的验证码了 } //干扰点 for ($i=0;$i<200;$i++){ $pointcolor=imagecolorallocate($image, mt_rand(50, 200), mt_rand(50, 200), mt_rand(50, 200)); imagesetpixel($image, mt_rand(1, 100), mt_rand(1,20), $pointcolor); //雪花 } //干扰线 for ($i=0;$i<3;$i++){ $linecolor=imagecolorallocate($image, mt_rand(50, 200), mt_rand(50, 200), mt_rand(50, 200)); imageline($image, mt_rand(1, 99), mt_rand(1, 99), mt_rand(1, 99), mt_rand(1, 99), $linecolor); } ob_clean(); header("content- type:image/png"); imagepng($image); imagedestroy($image);

    本文版权归QU快排Www.seoGurubLog.com 所有,如有转发请注明来出,竞价开户托管,seo优化请联系QQ▲61910465