ASP能不能调用其它网站网页返回的值?

我现在用ASP+IIS做了一个东西,但是现在在我的程序中希望和别的网站进行数据交互,该怎么办?
望各位不啬赐教!
---------------------------------------------------------------

可以通过xmlhttp来做取数据

 1   
 2const incFilePath = "f:\xml\" '包含文件所在目录,最后的\号是必须的   
 3const logfile = "d:\club-job-log.txt" '日志文件   
 4const incWeather = "GetWh.htm" '包含文件所在目录,最后的\号是必须的   
 5dim fs   
 6dim f   
 7on error resume next   
 8  
 9Set fs = CreateObject("Scripting.FileSystemObject")   
10dim wstr   
11wstr=getHTTPPage("http://202.106.103.44/forecast/fc06024.php")   
12'Response.Write wstr   
13wstr=right(wstr,len(wstr)-instr(wstr,"

<map name="Map">")+1)
wstr=replace(wstr,"fc06024.php","")
wstr1="<html><style>td,body{font-size:9pt}</style><body leftmargin="0" topmargin="0">"
wstr1=wstr1 &amp; "<div 1;="" absolute""="" id="overDiv" position:="" style="" z-index:=""></div>"
wstr1=wstr1 &amp; "<script language="JavaScript1.1" src="" tojava.js""=""></script>"
wstr1=wstr1 &amp; wstr
wstr1=wstr1 &amp; "<img #map""="" border="0" chinamapzj.gif""="" src="" usemap="" width="559"/>"
wstr1=wstr1 &amp; "</body></html>"
Response.Write wstr1
if err.number=0 then
Set f = fs.CreateTextFile(incFilePath &amp; incWeather,true)
f.write wstr1
set f = nothing
else
wscript.echo err.description
end if
set fs = nothing

Sub writeLog(Msg)
On Error Resume Next
Dim f
Set f = fs.OpenTextFile(logfile,8,true)
f.WriteLine now &amp; " - " &amp; Msg
f.close
End Sub

function getHTTPPage(url)
on error resume next
dim http
set http=createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate&lt;&gt;4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number&lt;&gt;0 then err.Clear
end function

Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode &lt; &amp;H80 Then
strReturn = strReturn &amp; Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn &amp; Chr(CLng(ThisCharCode) * &amp;H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function

1\---------------------------------------------------------------   
2  
3可以参考"如何获得新浪天气预报"那篇文章,网上很多.   
4\---------------------------------------------------------------   
5  
6你自己调用啊   
7\---------------------------------------------------------------   
8  
9现在除了*.JS,其他的都不能访问了。。。</map>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus