虚拟主机域名注册-常见问题API/CRX/插件 → 一键采集api


asp网站调用梦搏网络一键采集api示例
作者:
<% 
if Request("caiji_url")="" then 
%>
<%else%>
<script language="JScript" runat="Server">
    function toObject(json) {
        eval("var o=" + json);
        return o;
    }
      
</script>
<% 
response.Charset="GB2312" 
Response.Expires = -9999 
Response.AddHeader "Pragma","no-cache" 
Response.AddHeader "cache-ctrol","no-cache" 
 
caiurl="http://api.sinmeng.net/api/caiji/caiji.php?url="&Request("caiji_url")&"&key=你的key" 
 
Function GetBody(weburl) 
Dim ObjXMLHTTP 
Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP") 
ObjXMLHTTP.Open "GET",weburl,False 
ObjXMLHTTP.send 
While ObjXMLHTTP.readyState <> 4 
ObjXMLHTTP.waitForResponse 10000 
Wend 
GetBody=ObjXMLHTTP.responseBody 
Set ObjXMLHTTP=Nothing 
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 
 
pcontent=BytesToBstr(GetBody(caiurl),"gbk") 
'response.write(pcontent) 
 
Dim json
json = pcontent 
Set json = toObject(json)
'Response.Write json.title & " <br/>" 
'Response.Write json.content & " <br/>" 
caiji_title = json.title
caiji_content = json.content
Set json = Nothing 
%>
<%end if%>




来源:
阅读:2492
日期:2017-01-04

推荐朋友 】 【 评论 】  【 字体: 】 
上一篇:百度安全检测:您的网络环境极有可能性已被劫持,建议使用https://www.baidu.com访问
下一篇:php网站调用梦搏网络一键采集api示例
  >> 相关文章
 
发表评论


点  评: 字数0
用户名:  密码:

  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款