Ottenere informazioni sul tempo meteorologico di una città mediante il sito web wttr.in

Da Gambas-it.org - Wikipedia.

Il sito web "https://wttr.in/Roma" consente di conoscere il tempo meteorologico di una città.

In Gambas potrà essere consultato con almeno due soluzioni.

Il seguente codice si basa sul Componente "gb.qt5" (o "gb.gui.qt") di Gambas, ed è necessario attivare anche il Componente "gb.qt5.webkit" (o "gb.gui.qt.webkit").

Private wv As New WebView(Me) As "Webv"
Private tl As TextLabel


Public Sub Form_Open()

 With Me
   .W = Screen.AvailableWidth
   .H = Screen.AvailableHeight
 End With

 With tl = New TextLabel(Me)
   .X = 0
   .Y = 0
   .W = Me.W
   .H = Me.H
   .Background = Color.DarkGreen
 End With

 wv.Url = "https://wttr.in/Roma"

End


Public Sub Webv_Finish()

 tl.Text = wv.GetHtml()

End

In quest'altro esempio, invece, si dovranno attivare i Componenti "gb.net" e "gb.net.curl":

Public Sub Main()
 
 Dim hc As New HttpClient

 Print "\e[1m\e[31m"; hc.Download("https://wttr.in/Roma", Null)

End