https://foro.gambas-es.org/viewtopic.php?f=5&t=6871&p=41621#p41621
-----------------------------------
vuott
Sabado, 17 Marzo 2018, 03:43

Re: Programa Que Me Busca La Meteorologia Para Mi Ciudad.
-----------------------------------
...y mejor:
(hace falta activar los Componentes " [i]gb.net[/i] " y " [i]gb.net.curl[/i] ")

[code linenumbers=false syntax=gambas]Public Sub Main()
  
  Dim hc As New HttpClient
  
   Print hc.Download("http://wttr.in/Chaves", Null)
  
End[/code]


u otra manera:
[code linenumbers=false syntax=gambas]Private hf As New HttpClient As "CLI"
Private s As String


Public Sub Main()
  
  s = Temp
  
  With hf
    .URL = "http://wttr.in/Chaves"
    .Timeout = 10
    .Get(Null, s)
  End With

End


Public Sub CLI_Finished()
  
  hf.Close
  
  Print File.Load(s)
  
End[/code]

...y si preferimos variables locales:
[code linenumbers=false syntax=gambas]Public Sub Main()
  
  Dim hf As New HttpClient
  Dim s As String

  s = Temp
  
  With hf
    .URL = "http://wttr.in/Chaves"
    .Timeout = 10
    .Get(Null, s)
  End With

  Wait 0.5   ' Si no conseguimos resultados, tenemos que aumentar el valor de la espera.
  
  hf.Close
  
  Print File.Load(s)
  
End[/code]


