Sub Globals
Dim hc As HttpClient
Dim req As HttpRequest
End Sub
Sub Whatever ...
hc.Initialize("hc")
req.InitializeGet("https://weather.yahoo.com/sri-lanka/western/colombo")
hc.Execute(req, 1)
end Sub
Sub hc_ResponseSuccess(Response As HttpResponse, TaskId As Int)
Dim TR As TextReader
TR.Initialize(Response.GetInputStream) ' for ICS might have run response.GetAsynchronously ??
'find a starting point ...
Dim pattern, line As String
pattern = "<span class=" & Chr(34) & "c" & Chr(34) & "><span class=" & Chr(34) & "num" & Chr(34) & ">"
Do Until line.Trim = pattern
line = TR.ReadLine
Loop
'go down 2 more lines ..
line = TR.ReadLine
line = TR.ReadLine
myString = line.Trim
TR.Close
End Sub
Sub hc_ResponseError(Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Msgbox("Error: " & Response.GetString("UTF8"), "Error Accessing Web Page ...")
End Sub