以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 百度云fa piao识别 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=193091) |
-- 作者:wanglin3033 -- 发布时间:2024/8/16 9:07:00 -- 百度云fa piao识别 代码实例:https://ai.baidu.com/ai-doc/OCR/nk3h7xy2t Dim fpsb_url As String = "https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice?access_token={0}" Dim data() As Byte = System.IO.File.ReadAllBytes("c:\\2.png") \'把文件字节流加载进来, Dim d As String = Convert.ToBase64String(data) Dim hc As New HttpClient(CExp(fpsb_url, AccessToken)) hc.Headers.Add("Content-Type", "application/x-www-form-urlencoded") hc.C Dim zjo As New JObject Dim dt As String = """image=" & d & """" hc.Content = dt \'提交数据并发起OA流程\' zjo = JObject.Parse(hc.GetData()) \'获取流程发起ID Output.Show(zjo.ToString) [此贴子已经被作者于2024/8/16 9:30:44编辑过]
|
-- 作者:wanglin3033 -- 发布时间:2024/8/16 9:34:00 -- 使用APIpost 可以成功 此主题相关图片如下:apipost.png |
-- 作者:wanglin3033 -- 发布时间:2024/8/16 9:35:00 -- 此主题相关图片如下:apipost1.png |
-- 作者:有点蓝 -- 发布时间:2024/8/16 9:53:00 -- Dim fpsb_url As String = "https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice?access_token={0}" Dim data() As Byte = System.IO.File.ReadAllBytes("c:\\2.png") \'把文件字节流加载进来, Dim d As String = Convert.ToBase64String(data) Dim hc As New HttpClient(CExp(fpsb_url, AccessToken)) hc.ContentType = "application/x-www-form-urlencoded" hc.FormData.Add("image",UrlEncode(d)) Dim zjo As JObject = JObject.Parse(hc.GetData()) \'获取流程发起ID
[此贴子已经被作者于2024/8/16 9:53:27编辑过]
|
-- 作者:wanglin3033 -- 发布时间:2024/8/16 9:57:00 -- Dim fpsb_url As String = "https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice?access_token={0}" Dim data() As Byte = System.IO.File.ReadAllBytes("c:\\2.png") \'把文件字节流加载进来, Dim d As String = Convert.ToBase64String(data) Dim hc As New HttpClient(CExp(fpsb_url, AccessToken)) hc.Headers.Add("Content-Type", "application/x-www-form-urlencoded") hc.FormData.Add("image", d) Dim zjo As New JObject zjo = JObject.Parse(hc.GetData()) \'获取接口返回数据 Output.Show(zjo.ToString) 感谢 有点蓝的指点,最终代码是个,可以正常返回数据;不能对d 进行转码
[此贴子已经被作者于2024/8/16 10:03:44编辑过]
|