一、打码平台很多,这里选择两个:联众和斐斐

联众开发文档:

https://www.jsdati.com/docs/guide

斐斐开发文档:

http://docs.fateadm.com/web/#/1?page_id=1

二、联众打码

从文档可以看到联众的接口是 https://v2-api.jsdama.com/upload

大多数验证码类型是四位数字字母,从这里可以看到我们需要的类型是1001.查看类型地址:https://www.jsdati.com/docs/price

获取需要的参数并发送post请求即可:

    public class LianzhongRun
{
private const string ApiCode = "https://v2-api.jsdama.com/upload";
public static string LianZhongCode(string imgUrl)
{
var img64 = NetHandle.GetImageAsBase64Url(imgUrl).Result;
LianZhongRequestModel param = new LianZhongRequestModel();
param.captchaData = img64;
param.softwareId = ;
param.softwareSecret = "";
param.username = "";
param.password = "";
// captchaType 类型,查看:https://www.jsdati.com/docs/price
param.captchaType = ;
using (var _client = new HttpClient())
{
_client.DefaultRequestHeaders.Add("host", "v2-api.jsdama.com");
_client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36");
StringContent content = new StringContent(JsonConvert.SerializeObject(param), Encoding.UTF8,
"application/json");
HttpResponseMessage response = _client.PostAsync(ApiCode, content).Result;
string result = response.Content.ReadAsStringAsync().Result;
Console.WriteLine("返回结果--" + result);
if (!result.Contains("recognition")) return string.Empty;
dynamic resultObj = JsonConvert.DeserializeObject(result);
var data = resultObj["data"];
string recognition = data["recognition"];
Console.WriteLine("验证码:" + recognition);
return recognition.Trim();
}
}
}

三、斐斐打码

同样的方式,斐斐接口的请求代码如下

    public class FeifeiRun
{
private static string ApiCode = "http://pred.fateadm.com/api/capreg";
private static string PdId = "";
private static string PdKey = "";
private static string AppKey = "";
private static string AppId = ""; /// <summary>
/// 斐斐打码
/// </summary>
/// <param name="imgUrl"></param>
/// <returns></returns>
public static string FeifeiCode(string imgUrl)
{
var img64 = NetHandle.GetImageAsBase64Url(imgUrl).Result;
var timestamp = TimeHelper.GetCurrentTimeUnix();
string cur_tm = TimeHelper.GetCurrentTimeUnix();
string sign = SecurityHelper.CalcSign(PdId, PdKey, cur_tm);
string asign = SecurityHelper.CalcSign(AppId, AppKey, cur_tm);
var predict_type = "";
var imgBytes = NetHandle.ReadBytes(imgUrl);
var values = new Dictionary<string, string>
{
{ "user_id",PdId},
{ "timestamp",timestamp},
{ "sign",sign},
{ "app_id",AppId},
{ "asign",asign},
{ "predict_type",predict_type},
{ "img_data",img64}
}; using (var _client = new HttpClient())
{
var content = new FormUrlEncodedContent(values);
HttpResponseMessage response = _client.PostAsync(ApiCode, content).Result;
string result = response.Content.ReadAsStringAsync().Result;
var data = JsonConvert.DeserializeObject<HttpRspData>(result);
if (!string.IsNullOrEmpty(data.RspData))
{
// 附带附加信息
HttpExtraInfo einfo = JsonConvert.DeserializeObject<HttpExtraInfo>(data.RspData);
data.einfo = einfo;
}
var resultCode = data.einfo.result.Trim();
Console.WriteLine("code:" + resultCode);
return resultCode;
}
}
}

五、完整代码

https://github.com/DavideYang125/VerificationCodeObtainDemo

调用打码平台api获取验证码 (C#版)的更多相关文章

  1. asp.net 模拟CURL调用微信公共平台API 上传下载多媒体文

    近公司项目上在开发微信服务号的接口,需要给用户回复图片或语音或视频,这个时候就需要用到 上传下载多媒体文件接口,微信在这方面推荐采用的是开源函数库curl实现的,CURL项目包括很多版本,我主要测试的 ...

  2. 微信小程序wx.getLocation()获取经纬度及JavaScript SDK调用腾讯地图API获取某一类地址

    简介 腾讯位置服务为微信小程序提供了基础的标点能力.线和圆的绘制接口等地图组件和位置展示.地图选点等地图API位置服务能力支持,使得开发者可以自由地实现自己的微信小程序产品. 在此基础上,腾讯位置服务 ...

  3. asp.net 模拟CURL调用微信公共平台API 上传下载多媒体文件接口

    FormItem类 public class FormItem { public string Name { get; set; } public ParamType ParamType { get; ...

  4. Python3对接华三CAS平台Api获取虚拟机监控信息-渐入佳境

    --时间:2021年2月3日 --作者:飞翔的小胖猪 说明 使用python对接华三CAS虚拟化平台,通过厂商提供的api接口获取每个集群下所有虚拟机的监控信息,并保存数据在本地的mariadb数据库 ...

  5. Python 通过打码平台实现验证码

    在爬虫时,经常遇到登录需要验证码的情况,简单的验证码可以自己解决,复制的验证码需要借助机器学习,有一定的难度.还有一个简单的方案就是采用付费的打码平台. 比如R若快(http://www.ruokua ...

  6. 在C#中调用API获取网络信息和流量

    原文 在C#中调用API获取网络信息和流量 最近一项目中要求显示网络流量,而且必须使用C#. 事实上,调用 IpHlpApi.dll 的 GetIfTable API 可以轻易获得网络信息和网络流量. ...

  7. 【转】百度API获取城市名地名(附源码)

    在做一个软件时,用到了定位功能.网上有很多关于google 的GPS定位,但网上关于google定位都没有用, 搜索下原因:(这里建议大家在中国就尽量不使用系统自带的定位) 因为Google的服务器不 ...

  8. 百度AI开放平台- API实战调用

    百度AI开放平台- API实战调用 一.      前言 首先说一下项目需求. 两个用户,分别上传了两段不同的文字,要计算两段文字相似度有多少,匹配数据库中的符合条件的数据,初步估计列出来会有60-1 ...

  9. 如何使用Postman快速简单的调用快递物流平台快递鸟API接口

    前沿 快递鸟是一家聚合类的第三方快递物流平台,目前该平台提供的产品主要以API为主.由于API不能直观的看到产品效果,需要进行API对接联调成功后才能真实的看到产品的实际效果.但是如果一上来就写代码进 ...

随机推荐

  1. Python 今天抽空学习了@Property

    1.@Property有啥用 1) @property使方法像属性一样调用 @property可以把一个实例方法变成其同名属性,以支持.号访问,它亦可标记设置限制,加以规范 2) @property成 ...

  2. SQL-W3School-高级:SQL IN 操作符

    ylbtech-SQL-W3School-高级:SQL IN 操作符 1.返回顶部 1. IN 操作符 IN 操作符允许我们在 WHERE 子句中规定多个值. SQL IN 语法 SELECT col ...

  3. mongo 4.2版本注意事项

    参考文章: 4.0的安装 https://blog.csdn.net/qq_26896281/article/details/81203687 MongoDB4.0.0 远程连接及用户名密码认证登陆配 ...

  4. iOS——偏好设置的创建,数据写入与读取

    NSUserDefaults与NSDictinary? 应用通过NSUserDefaults用键值对的方式来读取和保存偏好设置数据,与通过键从NSDictionary对象中获取数据一样,不同之处在于N ...

  5. 在 Laravel 中使用 MongoDB

     可参考:https://blog.csdn.net/weixin_38682852/article/details/80840678 环境准备 安装 MongoDB 安装 PHP-MongoDB 扩 ...

  6. VC程序运行时间测试函数

    VC程序运行时间测试函数 介绍 我们在衡量一个函数运行时间,或者判断一个算法的时间效率,或者在程序中我们需要一个定时器,定时执行一个特定的操作,比如在多媒体中,比如在游戏中等,都会用到时间函数.还比如 ...

  7. 后端 SpringBoot + 前端 vue 打包发布到Tomcat

    近段时间 做了一些前后端的开发 需要在Tomcat里进行发布    把自己整理的分享出来 后端打包 pom.xml 文件 <packaging>war</packaging> ...

  8. linux 系统自签免费ssl证书和nginx配置

    首先执行如下命令生成一个key openssl genrsa -des3 -out ssl.key 1024 然后他会要求你输入这个key文件的密码.不推荐输入.因为以后要给nginx使用.每次rel ...

  9. Shortest Unsorted Continuous Subarray

    Given an integer array, you need to find one continuous subarray that if you only sort this subarray ...

  10. iostream重载__int128

    Normal (Naive)写法,用 string(char* ) std::ostream& operator <<(std::ostream&out,const __i ...