7,788
社区成员
发帖
与我相关
我的任务
分享
Dim oSc As SoapClient
Dim oSc As New SoapClient
Dim buff() As Byte
Dim hFile As Integer
oSc.ClientProperty("ServerHTTPRequest") = True
oSc.mssoapinit ("http://www.webxml.com.cn/webservices/ChinaStockSmallImageWS.asmx?WSDL")
buff = oSc.getSmallImageByte("sh000001", 1)
hFile = FreeFile
Open App.Path & "\GP001.gif" For Binary Access Write As hFile
Put hFile, 1, buff
Close hFile
Picture1.Picture = LoadPicture(App.Path & "\GP001.gif")
Set oSc = Nothing
读取这个XML:
Dim oXmlNode As IXMLDOMNode
Dim oXmlNodes As IXMLDOMNodeList
Set oXmlNodes = oXmlDoc.documentElement.selectNodes(".//string")
For Each oXmlNode In oXmlNodes
Debug.Print oXmlNode.Text
Next
dim city as string
city=oXmlNodes(1).Text
msgbox city
Dim oHTTP As XMLHTTP
Dim oXmlDoc As DOMDocument
Dim strWebserviceURL As String, strRequest As String
Dim s As String
strWebserviceURL = "http://www.webxml.com.cn/WebServices/WeatherWebService.asmx/getWeatherbyCityName"
strRequest = "theCityName=南京"
Set oHTTP = New XMLHTTP
oHTTP.Open "POST", strWebserviceURL, False
oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
oHTTP.send (strRequest)
Set oXmlDoc = New DOMDocument
oXmlDoc.Load oHTTP.responseXML
'oXmlDoc.Save (App.Path & "\wh.xml")
Debug.Print oXmlDoc.Text
Dim xmlDoc As MSXML2.XMLHTTP
Private Sub Command1_Click()
Set xmlDoc = New MSXML2.XMLHTTP
xmlDoc.open "post", "http://php.weather.sina.com.cn/search.php?city=南京", False
xmlDoc.send
MsgBox xmlDoc.responseText
End Sub
'得到的HTML码xmlDoc.responseText,通过处理可以得所要的数据