Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
APICall = "[URL unfurl="true"]https://dev.virtualearth.net/REST/v1/LocalSearch/"[/URL]
Query = "?type=Hospitals&maxResults=5&userLocation=47.602038,-122.333964,8046.72&o=xml"
strKey = "&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Set oxmlhttp2 = New MSXML2.ServerXMLHTTP60
oxmlhttp2.Open "get", APICall & Query & strKey, False
oxmlhttp2.setRequestHeader "Content-Type", "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]
oxmlhttp2.send sRequest
Set oXMLDoc2 = New MSXML2.DOMDocument60
oXMLDoc2.async = False
If oxmlhttp2.readyState = 4 Or oxmlhttp2.Status = 200 Then
result = oXMLDoc2.loadXML(oxmlhttp2.responseText)
Text1.Text = oxmlhttp2.responseText
Else
result = False
End If
MsgBox oXMLDoc2.xml
'Get a nodelist
Set objNodelist = oXMLDoc2.selectNodes("//Response/ResourceSets/ResourceSet/Resources/Resource")
'Loop through the nodelist and pull the vaules you need
For Each objNode In objNodelist
MsgBox objNode.selectSingleNode("Name").Text
MsgBox objNode.selectSingleNode("Point").Text
Next objNode
'Cleanup
Set objNodelist = Nothing
If oxmlhttp2.readyState = 4 Or oxmlhttp2.Status = 200 Then
result = oXMLDoc2.loadXML(oxmlhttp2.responseText)
Else
result = False
End If
XMLStr = oXMLDoc2.xml
XMLStr = Replace(XMLStr, " xmlns:xsd=" & Chr(34) & "[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] & Chr(34), "")
XMLStr = Replace(XMLStr, " xmlns:xsi=" & Chr(34) & "[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] & Chr(34), "")
XMLStr = Replace(XMLStr, " xmlns=" & Chr(34) & "[URL unfurl="true"]http://schemas.microsoft.com/search/local/ws/rest/v1"[/URL] & Chr(34), "")
XMLStr = Replace(XMLStr, " xsi:type=" & Chr(34) & "SearchResult" & Chr(34), "")
oXMLDoc2.loadXML XMLStr
Set node = oXMLDoc2.selectSingleNode("//Response/ResourceSets/ResourceSet/EstimatedTotal")
MsgBox node.Text ' How many were returned out of 5 max results
Set nodes = oXMLDoc2.selectNodes("//Response/ResourceSets/ResourceSet/Resources/Resource")
For Each node In nodes
MsgBox node.selectSingleNode("Name").Text ' Hospital Name
MsgBox node.selectSingleNode("Point/Latitude").Text ' Hospital Latitude
MsgBox node.selectSingleNode("Point/Longitude").Text ' Hospital Longitude
Next