[Gambas-bugtracker] Bug #2766: HttpClient: URL using bad/illegal format or missing URL

bugtracker at gambaswiki.org bugtracker at gambaswiki.org
Thu Jul 13 23:34:40 CEST 2023


http://gambaswiki.org/bugtracker/edit?object=BUG.2766&from=L21haW4-

Comment #1 by Omar MORENO:

This is the Sub I'm using:

Private Sub ObtenerJSONCollection(URLApi As String) As Variant
  '
  Dim HClient As HttpClient
  Dim SBuffer As String
  Dim JSVarBuffer As Variant
  '
  HClient = New HttpClient As "hClient" 
  HClient.URL = URLApi  
  HClient.Async = False
  HClient.Timeout = 60
  HClient.Get
  '
  If HClient.Status < 0 Then
    Message.Error("Error: " & HClient.Status & "<br>" & HClient.ErrorText, "CERRAR")
  Else
    If Lof(HClient) Then sBuffer = Read #HClient, Lof(HClient)
    '
    JSVarBuffer = JSON.FromString(SBuffer, True)
    '
  Endif
  '
  Return JSVarBuffer
  '
  Catch 
    Message.Error("ObtenerJSONCollection: " & Error.Text, "OK")
    Return JSVarBuffer
End




More information about the Bugtracker mailing list