05-07-2019, 12:33 AM
this so far has no error protection so when it errors it fails. the idea is to make it robust and catch potential errors
something like this
Function Function18
something like this
Function Function18
typelib WinHttp {662901FC-6951-4854-9EB2-D9A2570F2B2E} 5.1
WinHttp.WinHttpRequest r._create
r.Open("POST" "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=24.b305c9822131e65eda05e29c157dd719.2592000.1559103982.282335-16139329")
r.setRequestHeader("content-type", "application/x-www-form-urlencoded") ;r.SetRequestHeader("language_type" , "CHN_ENG")
str sFile.getfile("$desktop$\100jhkjghjkg0.png");; change to file location
err goto endof
str base64.encrypt(4 sFile "" 2) ;base64.escape(9)
r.Send(F"&image={base64}")
err goto endof
ARRAY(byte) by= r.ResponseBody
out r.Status
sel r.Status
,case 200 ;;The request completed successfully.
,str json.fromn(&by[0] by.len) ;out json
,case 404 ;;The server has not found anything that matches the requested URI.
,out "error"
,case else out "Fail"
ret
;endof
out _error.description
ret