以下是引用bzdm在2020-7-7 20:07:21的发言:
楼主你好,能否给个事例
程序代码:
CLEAR
Http = CreateObject("MSXML2.XMLHttp")
Http.Open("Post","https://aip./oauth/2.0/token?grant_type=client_credentials&client_id=你的id&client_secret=你的secret",.F.)
Http.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded")
Http.Send()
lcReturn = Http.ResponseText
*从lcReturn中获取token
lcimage = Filetostr('发票.JPG')
lcimage1 = STRCONV(lcimage,13)
Set Library To myfll
lcimage2 = URLEncode(lcimage1)
Set Library To
StrPost = 'access_token=获取的token' + '&image=' + lcimage2 + '¶graph=true&probability=true'
Http.Open("Post","https://aip./rest/2.0/ocr/v1/vat_invoice",.F.)
Http.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded")
Http.Send(StrPost)
lcReturn = Http.ResponseText
*从lcReturn中获取你要的信息,比如发票金额等!