Function GetGeoCoords(ByVal inString as String) As String
Dim xmlString As String = GetHTML("http://maps.google.com/maps/geo?output=xml&key=abcdefg&q=" & inString, 1)
Chunks = Regex.Split(xmlString, "coordinates>", RegexOptions.Multiline)
outString = Replace(Chunks(1), ",0</", "")
End Function
Public Function GetHTML(ByVal sURL As String, ByVal e As Integer) As String
Dim oHttpWebRequest As System.Net.HttpWebRequest
Dim sChunk As String
oHttpWebRequest = (System.Net.HttpWebRequest.Create(sURL))
Dim oHttpWebResponse As System.Net.WebResponse = oHttpWebRequest.GetResponse()
oStream = oHttpWebResponse.GetResponseStream
sChunk = New System.IO.StreamReader(oStream).ReadToEnd()
oStream.Close()
oHttpWebResponse.Close()
If e = 0 Then
Return Server.HtmlEncode(sChunk)
Else
Return Server.HtmlDecode(sChunk)
End If
End Function
-
2 comments:
I will give it a try. Thanks.
OK so I tried this and got confused. Im a bit of a VB newbie - the line
Return Server.HtmlEncode(sChunk)
returns an error as 'Name Server is not declared.
Any ideas?
Post a Comment