Dim AppKey As String = ""
Dim AppSecret As String = ""
Dim AppCode As String = ""
'Dim hc As New HttpClient("http://ali-deliver.showapi.com/showapi_expInfo?com=shunfeng&nu=929601675231")
'Dim hc As New HttpClient("http://dm-51.data.aliyun.com/rest/160601/ocr/ocr_idcard.json?com=shunfeng&nu=929601675231")
'hc.Headers.Add("Authorization","APPCODE " & "7858a126750949e4a36371580f420413")
'制作本地图片的base64串
Dim bendilujing As String
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "图形文件|*.bmp;*.jpg;*.jpeg;*.png"
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Else
Return Nothing
End If
bendilujing = dlg.FileName
'MessageBox.Show(bendilujing)
Dim bmp As new Bitmap(bendilujing)
Dim ms As new System.Io.MemoryStream()
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arr(ms.Length) As Byte
ms.Position = 0
ms.Read(arr, 0, ms.Length)
ms.Close()
Dim strbaser64 As String = Convert.ToBase64String(arr)
bmp.dispose
'msgbox("读取数据完毕")
'制作json
Dim jo As New JObject
jo("image") = strbaser64
'jo("configure") = "{\"side\":\"face\"}"
jo("configure") = New JObject
jo("configure")("face") = "face"
msgbox("读取数据完毕")
'msgbox(jo.ToString)
Dim hc As New HttpClient("http://dm-51.data.aliyun.com/rest/160601/ocr/ocr_idcard.json")
hc.Headers.Add("Authorization","APPCODE " & AppCode)
hc.Content = jo.ToString
jo = Jobject.Parse(hc.GetData)
msgbox(jo("name"))
Return Nothing
结果显示错误464
确实不会,尝试很多次,里面有很多地方不明白,请教了,万分感谢