Hello all,
I am trying to write a console application. This connects to a website and brings back json. Response can be two type. If there is a valid json, it will send it. If there is none, it will send an xml with error. The following code is working fine if the response is a valid json. However, if the response is an error, it is printing the whole response even though I do not have a log command. Also, it seems to ignore the if statement that prints "Yes" if there is an error. Will appreciate any help regarding this.
Thanks.
I am trying to write a console application. This connects to a website and brings back json. Response can be two type. If there is a valid json, it will send it. If there is none, it will send an xml with error. The following code is working fine if the response is a valid json. However, if the response is an error, it is printing the whole response even though I do not have a log command. Also, it seems to ignore the if statement that prints "Yes" if there is an error. Will appreciate any help regarding this.
Thanks.
B4A Console App Code:
'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
DownloadQuote
StartMessageLoop
End Sub
Sub DownloadQuote
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://cdn.cboe.com/api/global/delayed_quotes/term_structure/2021/VIX_2021-07-31.json")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim s As String = j.GetString
End If
If s.Contains("<Error>") Then
Log("Yes")
End If
j.Release
ExitApplication
End Sub