其他接口 ·

随机图片验证码

可生成在线随机图片验证码

请求地址:https://blackcatw.com/api

请求方式:GET

参数                   说明

name        VERIFY

Imgtype    类型:1 算数验证码   2  随机汉字验证  3  大小写字母数字混合验证码

返回参数说明:

ImgUrl          验证码图片地址

verifyCode      验证码的值

ImgBase64     此值会返回验证码的base64字符串

例如:https://www.blackcatw.com/api/?name=VERIFY&Imgtype=3

请求demo:点击下载

<?php 
$arr =  json_decode(getImg("https://www.blackcatw.com/api/?name=VERIFY&Imgtype=1"),true);  
echo "图片地址:".$arr['ImgUrl'];
echo "<br>";
echo "图片对应的验证码的值:".$arr['verifyCode'];
echo "<br>";
echo "返回验证码的base64字符串".$arr['ImgBase64'];
$img=base64_decode($arr['ImgBase64']);
echo "<img src="$img">";

function getImg($url){
   $curl = curl_init();
   curl_setopt_array($curl, array(
      CURLOPT_URL => $url,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
     CURLOPT_CUSTOMREQUEST => 'GET',
    ));  
    $response = curl_exec($curl);
    curl_close($curl);
    return $response;
}

?>

 

返回示例:

{"ImgUrl":"https://www.blackcatw.com/api/20221122/166904813382481.png","verifyCode":44,"ImgBase64":"ZGF0YTppbWFnZS9qcGVnO2Jhc2U2NCwvOWovNEFBUVNrWkpSZ0FCQVFBQUFRQUJBQUQvL2dBN1ExSkZRVlJQVWpvZ1oyUXRhbkJsWnlCMk1TNHdJQ2gxYzJsdVp5QkpTa2NnDQpTbEJGUnlCMk5qSXBMQ0J4ZFdGc2FYUjVJRDBnTlRBSy85c0FRd0FRQ3d3T0RBb1FEZzBPRWhFUUV4Z29HaGdXRmhneEl5VWRLRG96DQpQVHc1TXpnM1FFaGNUa0JFVjBVM09GQnRVVmRmWW1kb1p6NU5jWGx3WkhoY1pXZGovOXNBUXdFU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