手机号转成网页链接API形式
别人给我的一段 我有设备
TracePrint 取指定com内容(244)'获取对应com的内容(不同com代表不同手机号)
TracePrint 取指定com内容(240)
TracePrint 取指定com内容(252)
Function 取指定com内容(参数)
Call Plugin.Web.ClearTemp()’清理浏览器缓存
网站 = "https://**"
Call 下载网络文件(网站, "C:\1.txt")'一种代替直接获取网络源文件的写法
Text = Plugin.File.ReadFileEx("C:\1.txt")
Text = Unicode编码转文字(Text)
第一次 =Split( GetStrAB(Text,"msg"&chr(34)&":"&chr(34),"com"&chr(34)&":"&chr(34)&参数),chr(34))(0)'取两个字符串中间的内容
取指定com内容= 第一次
End Function
Function GetStrAB(Str, StrA, StrB)
Dim i,ArrStrA,Ck
ArrStrA=Split(Str,StrA)
For i = 1 To UBound(ArrStrA)
If InStr(ArrStrA(i), StrB) > 0 Then
// TracePrint Split(ArrStrA(i), StrB)(0)
GetStrAB=Split(ArrStrA(i), StrB)(0)
Exit Function
End If
Next
GetStrAB=Ck
End Function
Function HttpgetEx2(网页地址, 选项1至2)//多个参数.设置编码.跟乱码说88
//Plugin.Sys.SetCLB(lib.网络.获得网页源文件_增强版("www.baidu.com","utf-8")) //百度
//Plugin.Sys.SetCLB(lib.网络.获得网页源文件_增强版("www.sina.com.cn","gbk")) //新浪
Dim xmlHttp, xmlUrl,ObjStream
If InStr(网页地址, "http://") = 0 Then
xmlUrl = "http://" & 网页地址
Else
xmlUrl = 网页地址
End if
Set xmlHttp = CreateObject("WinHttp.WinHttpRequest.5.1") //用这个对象,跟缓存/cookie 干扰说88
xmlHttp.Open "GET", xmlUrl, True
xmlHttp.Send
If xmlhttp.waitforresponse() Then
Set ObjStream = CreateObject("Adodb.Stream")
ObjStream.Type = 1
ObjStream.Mode = 3
ObjStream.Open
ObjStream.Write xmlHttp.ResponseBody
ObjStream.Position = 0
ObjStream.Type = 2
Select Case 选项1至2
Case 1
网页编码="utf-8"
Case 2
网页编码="gbk"
End Select
ObjStream.Charset = 网页编码
HttpgetEx2 = ObjStream.ReadText
Set ObjStream = Nothing
Else
HttpgetEx2 = "" //如果获取失败返回值是 空
End If
Set xmlHttp = Nothing
End Function
Function Unicode编码转文字(编码内容)
Unicode编码转文字=""
Do Until instr(编码内容, "\u") = 0
进制编码 = Replace(mid(编码内容, instr(编码内容, "\u"), 6), "\u", "&H")
编码内容 = Replace(编码内容, Replace(进制编码,"&H","\u") , Eval("ChrW(" & 进制编码 & ")"))
Delay 10
loop
Unicode编码转文字= 编码内容
End Function
Function 下载网络文件(网络http, 本地路径)
Dim url
url = 网络http '这里写你要下载文件的全路径
Set obj1 = CreateObject("msxml2.xmlhttp")
Set obj2 = CreateObject("adodb.stream")
obj1.open "get",url,False
obj1.send
temp = obj1.responseBody
obj2.Type = 1
obj2.Mode = 3
obj2.Open
obj2.Write(temp)
obj2.SaveToFile 本地路径,2 '2的意思是已有则覆盖
obj2.Close
End Function