05-06-2019, 02:44 AM
also a better idea instead of using
_s.replacerx("\+" "%2B")
use instead
_s.escape(9)
it's what its for.. It urlencodes the data. that is what the original problem was the data needed to be urlencoded
full code
_s.replacerx("\+" "%2B")
use instead
_s.escape(9)
it's what its for.. It urlencodes the data. that is what the original problem was the data needed to be urlencoded
full code
typelib WinHttp {662901FC-6951-4854-9EB2-D9A2570F2B2E} 5.1
WinHttp.WinHttpRequest r._create
r.Open("POST" F"https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic")
r.setRequestHeader("content-type", "application/x-www-form-urlencoded")
r.SetRequestHeader("cache-control" , "no-cache")
str access= "access_token=24.b305c9822131e65eda05e29c157dd719.2592000.1559103982.282335-16139329&image="
str sFile.getfile("$desktop$\2.png");; change to file location
_s.encrypt(4 sFile "" 2)
_s.escape(9)
r.Send(F"{access}{_s}")
IXml x=JsonToXml(r.ResponseText)
ARRAY(IXmlNode) a; x.Path("root/words_result/item/words" a 1)
int i; for(i 0 a.len) out a[i].Value