xmlhttp获取utf-8型网页,怎么将获取的内容中汉字替换
来源:
互联网
日期:2008-7-26
<% Function GetHttpPage(HttpUrl) If IsNull(HttpUrl)=True Or Len(HttpUrl)<18 Or HttpUrl="$False$" Then GetHttpPage="$False$" Exit Function End If Dim Http Set Http=server.createobject("MSX" & "ML2.XM" & "LHT" & "TP") Http.open "GET",HttpUrl,False Http.Send() If Http.Readystate<>4 then Set Http=Nothing GetHttpPage="$False$" Exit function End if GetHTTPPage=bytesToBSTR(Http.responseBody,"utf-8") GetHTTPPage=replace(replace(GetHTTPPage , vbCr,""),vbLf,"") Set Http=Nothing If Err.number<>0 then Err.Clear End If End Function
Function BytesToBstr(Body,Cset) Dim Objstream Set Objstream = Server.CreateObject("ad" & "odb.str" & "eam") 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
url1 = "www.baidu.com" str1 = GetHttpPage(url1) str1 = replace(str1,"百度","711") response.write str1 %>
更多的xmlhttp获取utf-8型网页,怎么将获取的内容中汉字替换请到论坛查看: http://BBS.TC711.COM
【 双击滚屏 】 【 评论 】 【 收藏 】 【 打印 】 【 关闭 】
来源:
互联网
日期:2008-7-26
|
|
|