求助 :用 ASP 小偷 获取 京东商城 产品价格
想实时获取 京东商城产品价格
思路是 用 asp 小偷 根据页面的参数调用
京东地址 : http://book.360buy.com/10892222.html
10892222 就是参数 cid 根据这个来查询 特定的页面
然后获取 页面内的产品价格 【京东价:¥20.30(8.2折)(降价通知)】 里面的 ¥20.30
调用方法是 <SCRIPT src=weather.asp?cid=10892222></SCRIPT>
以下为 很久以前的获取腾讯天气的简单代码 谁能帮我改下 谢谢啦 分不多 所有的啦
请一定帮我写详细的代码哈 我是小白 自己不会写
<%
Dim cid
cid=Request("cid")
%>
document.write("<%=a%> <%=cid%>")
<%
on error resume next
function weather(cid)
DIM Product(5)
content = getHTTPPage("http://book.360buy.com/%cid%.html")
cc = split(content," <span id=""priceinfo"" class=""price"">")
'<span id="priceinfo" class="price">¥20.30</span>
response.write (cc)
for each a in cc
a1 = split(a,"</font></td><td>")'a1(0)为城市
if (a1(0)=city) then
'response.write a1(0)&a1(1)
a2 = split(a1(1),"</td><td>")'a2(0)天气,a2(1)最高温度,a2(2)最低温度
Product(0) = city
Product(1) = a2(0)
Product(2) = a2(1)
Product(3) = a2(2)
a3 = split(a2(3),"</td>")
Product(4) = a3(0)
exit for
end if
'response.write a&vbcrlf
next
weather = Product
end function
response.write city&vbcrlf&a2(0)&vbcrlf&a2(1)&vbcrlf&a2(2)&vbcrlf&wind
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 getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
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
&