Sample code for 30+ languages & platforms
Visual Basic 6.0

Example: Http.SetUrlVar method

Demonstrates the HTTP SetUrlVar method.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim http As New ChilkatHttp

Dim url As String
url = "https://finnhub.io/api/v1/quote?symbol={$symbol}&token={$api_key}"

' When the request is sent, the {$symbol} is replaced with "MSFT"
' and the {$api_key} is replaced with "1234567890ABCDEF"
success = http.SetUrlVar("symbol","MSFT")
success = http.SetUrlVar("api_key","1234567890ABCDEF")

Dim sbJson As New ChilkatStringBuilder
success = http.QuickGetSb(url,sbJson)
If (success = 0) Then
    Debug.Print http.LastErrorText
    Exit Sub
End If

Dim statusCode As Long
statusCode = http.LastStatus
If (statusCode <> 200) Then
    Debug.Print "Status code: " & statusCode
    Debug.Print "Error Message:"
    Debug.Print sbJson.GetAsString()
Else
    Debug.Print "JSON Stock Quote:"
    Debug.Print sbJson.GetAsString()
End If

' Output:

' JSON Stock Quote:
' {"c":522.98,"d":0.5,"dp":0.0957,"h":524.51,"l":520.86,"o":524.28,"pc":522.48,"t":1755271948}