Import "ShanHai.lua"
Dim result
Function btsendcode(user, pwd, img, typeid)
Dim PostHost = "https://www.bingtop.com/ocr/upload/"
Dim captchaData = ShanHai.Base64En(img)
result = URL.Post(PostHost, "username=" & user & "&password=" & pwd & "&captchaData=" & captchaData & "&captchaType=" & typeid)
TracePrint result
End Function
'以下4个值是您要修改的地方
'您要识别的图片路径
Dim img = File.Read("/sdcard/Pictures/demo.png")
'请填您的用户名
Dim username = "填您的用户名"
'请填您的密码
Dim password = "填您的密码"
'请填对应的识别类型,详见:https://www.bingtop.com/type/
Dim imgType = "1000"
btsendcode(username, password, img, imgType)
Dim myjson = Encode.JsonToTable(result)
'获取到识别结果
Dim mycode = myjson["data"]["recognition"]
TracePrint(mycode)