![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Example: Http.SetUrlVar methodDemonstrates the HTTP SetUrlVar method.
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Handle hoHttp String sUrl Variant vSbJson Handle hoSbJson Integer iStatusCode String sTemp1 Move False To iSuccess Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Move "https://finnhub.io/api/v1/quote?symbol={$symbol}&token={$api_key}" To sUrl // When the request is sent, the {$symbol} is replaced with "MSFT" // and the {$api_key} is replaced with "1234567890ABCDEF" Get ComSetUrlVar Of hoHttp "symbol" "MSFT" To iSuccess Get ComSetUrlVar Of hoHttp "api_key" "1234567890ABCDEF" To iSuccess Get Create (RefClass(cComChilkatStringBuilder)) To hoSbJson If (Not(IsComObjectCreated(hoSbJson))) Begin Send CreateComObject of hoSbJson End Get pvComObject of hoSbJson to vSbJson Get ComQuickGetSb Of hoHttp sUrl vSbJson To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComLastStatus Of hoHttp To iStatusCode If (iStatusCode <> 200) Begin Showln "Status code: " iStatusCode Showln "Error Message:" Get ComGetAsString Of hoSbJson To sTemp1 Showln sTemp1 End Else Begin Showln "JSON Stock Quote:" Get ComGetAsString Of hoSbJson To sTemp1 Showln sTemp1 End // 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} End_Procedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.