Some Client Script

client vbscript:
Function postXMLData(PostData,targetUrl)
    
Dim oXml,oData,oUrl
    
Set oXml = CreateObject("Microsoft.XMLHTTP")
    oData 
=PostData
    oUrl
=targetUrl
    oXml.Open(
"post",oUrl,false)
    oXml.setrequestheader(
"content-length",len(oData))
    oXml.setrequestheader(
"content-type","application/x-www-form-urlencoded")
    oXml.send(oData)
    postXMLData = oXML.responseText 
End Function

Function URLEncoding(vstrIn)
    
Dim strReturn,ThisChr,innerCode,Hight8,Low8
    strReturn 
= ""
    For i = 1 To Len(vstrIn)
        ThisChr 
= Mid(vStrIn,i,1)
        
If Abs(Asc(ThisChr)) < &HFF Then
            strReturn 
= strReturn & ThisChr
        
Else
            innerCode 
= Asc(ThisChr)
            
If innerCode < 0 Then
                innerCode 
= innerCode + &H10000
            
End If
            Hight8 
= (innerCode  And &HFF00) &HFF
            Low8 
= innerCode And &HFF
            strReturn 
= strReturn & "%" & Hex(Hight8) &  "%" & Hex(Low8)
        
End If
    
Next
    URLEncoding 
= strReturn
End Function

Function bytes2BSTR(vIn)
    
Dim strReturn,ThisCharCode,NextCharCode
    strReturn 
= ""
    For i = 1 To LenB(vIn)
        ThisCharCode 
= AscB(MidB(vIn,i,1))
        
If ThisCharCode < &H80 Then
            strReturn 
= strReturn & Chr(ThisCharCode)
        
Else
            NextCharCode 
= AscB(MidB(vIn,i+1,1))
            strReturn 
= strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
            i 
= i + 1
        
End If
    
Next
    bytes2BSTR 
= strReturn
End Function
posted @ 2004-09-04 18:31 七月(Lost) 阅读(1255) 评论(4)  编辑 收藏

  回复  引用    
#1楼 2004-09-04 19:45 | Ninputer [未注册用户]
Why don't you explain them? What are these?
  回复  引用  查看    
#2楼 2004-09-04 19:58 | 梦虫      
Very easy,I just put a mark!
  回复  引用  查看    
#3楼 2004-09-04 20:12 | 梦虫      
以 application/x-www-form-urlencoded post 的数据 需要经过URL编码的,否则服务器是取不到中文值的
获取的返回数据是 unsigned bytes
bytes2BSTR 则将 unsigned bytes 转换 string
  回复  引用  查看    
#4楼 2004-09-05 19:27 | 灵感之源      
建议直接在原贴内容中修改,添加注释。

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
该文被作者在 2004-09-04 19:59 编辑过
"五向定位"职业成长路线公开课(上海、南京、大连)
Google站内搜索


相关链接: