RosettaCodeData/Task/Web-scraping/VBScript/web-scraping.vb

31 lines
687 B
VB.net
Raw Permalink Normal View History

2018-06-22 20:57:24 +00:00
Function GetUTC() As String
Url = "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
With CreateObject("MSXML2.XMLHTTP.6.0")
.Open "GET", Url, False
.send
arrt = Split(.responseText, vbLf)
End With
For Each t In arrt
If InStr(t, "UTC") Then
GetUTC = StripHttpTags(t)
Exit For
End If
Next
2015-11-18 06:14:39 +00:00
End Function
Function StripHttpTags(s)
2018-06-22 20:57:24 +00:00
With New RegExp
.Global = True
.Pattern = "\<.+?\>"
If .Test(s) Then
StripHttpTags = .Replace(s, "")
Else
StripHttpTags = s
End If
End With
2015-11-18 06:14:39 +00:00
End Function
WScript.StdOut.Write GetUTC
WScript.StdOut.WriteLine