asp 图文识别 利用百度API实现 完整版

朋友需要一个asp图文识别代码,分享出来,有需要的朋友拿去吧

<%
pictext = "此处为图片链接地址"
access_token="此处获取百度API-access_token"
url = "https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic?access_token="&access_token&"&url="&pictext&""
wstr=getHTTPPage(url)
aryReturn = Split(wstr,"},{")
'ASP获取远程网页指定内容开始
For i = LBound(aryReturn) To UBound(aryReturn)
Response.Write("返回值数组中的元素[" & i & "]:" & Right(aryReturn(i),Len(aryReturn(i))-8) & "<br>")
Next
%>
<%
'用ASP获取远程目标网页指定内容 更多的代码来这里找 http://yige.org
On Error Resume Next
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"UTF-8")
End function
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
End Function
%>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值