<%  
	  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 


function xmlGet(url)
	set objXML = server.CreateObject("MSXML2.ServerXMLHTTP.3.0")
	objXML.open "GET", url, false
	objXML.setRequestHeader "Accept","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*"
	objXML.setRequestHeader "Accept-Language","zh-cn"
	objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
	objXML.setRequestHeader "Accept-Encoding", "gzip, deflate"
	objXML.setRequestHeader "User-Agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
	objXML.setRequestHeader "Connection","Keep-Alive" 
	objXML.setRequestHeader "Cache-Control","no-cache"
	objXML.send()
	'If objXml.readyState<>4 then
	'	Response.Write "ERROR"
	'	Response.End
	'end if
	set oStream = server.CreateObject("ADODB.Stream")
	oStream.Type=1
	oStream.Mode=3
	oStream.Open()
	oStream.Write objXML.responseBody
	oStream.Position= 0
	oStream.Type= 2
	oStream.Charset="gb2312"
	ReturnText = oStream.readtext()
	oStream.Close()
	set oStream = nothing
	set objXML = nothing
	xmlGet = ReturnText	
end function


 
Function SendToSp(PostUrl)
        Server.ScriptTimeOut=72000
       
	    Set oXMLHttp = createObject("Microsoft.XMLHTTP")
		Call oXMLHttp.Open("get", PostUrl, false)
		Call oXMLHttp.Send("")
		sHtmlStr =  oXMLHttp.responseBody 
		Set oXMLHttp = nothing 
		
		SendToSp=sHtmlStr
End Function 

Function Bytes2bStr(p_sHtmlStr)
	dim sReturnStr
	dim i,n
	sReturnStr = ""
	n = LenB(p_sHtmlStr)
	
	For i = 1 To n
		dim sCharCode
		dim sNextCharCode
		sCharCode = AscB( MidB(p_sHtmlStr, i, 1) )
		
		If (sCharCode < &H80) Then
			sReturnStr = sReturnStr & Chr(sCharCode)
		Else
			sNextCharCode = AscB( MidB(p_sHtmlStr, i+1, 1) )
			sReturnStr = sReturnStr & Chr(CLng(sCharCode) * &H100 + CInt(sNextCharCode))
			i = i + 1
		End If
	Next
	
	Bytes2bStr = sReturnStr
End Function

function urldecode(encodestr) 
newstr="" 
havechar=false 
lastchar="" 
for i=1 to len(encodestr) 
char_c=mid(encodestr,i,1) 
if char_c="+" then 
newstr=newstr & " " 
elseif char_c="%" then 
next_1_c=mid(encodestr,i+1,2) 
next_1_num=cint("&H" & next_1_c) 
if havechar then 
havechar=false 
newstr=newstr & chr(cint("&H" & lastchar & next_1_c)) 
else 
if abs(next_1_num)<=127 then 
newstr=newstr & chr(next_1_num) 
else 
havechar=true 
lastchar=next_1_c 
end if 
end if 
i=i+2 
else 
newstr=newstr & char_c 
end if 
next 
urldecode=newstr 
end function
%>
