Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) HTTP GET with utf-8 URL Encoded Query ParamsDemonstrates how to build URLs where query param values can be either URL encoded from the utf-8 representation, or from another charset such as windows-1252. Note: This example uses the new DecodeAndAppend method added in Chilkat v9.5.0.87.
Use ChilkatAx-win32.pkg Procedure Test String sNameWindows1252UrlEncoded Handle hoSb1 Boolean iSuccess Handle hoHttp Handle hoSbUrl String sResponseBody String sTemp1 // We have the string "MÆRSK". // This is the URL encoding of the windows-1252 representation. Move "M%C6RSK" To sNameWindows1252UrlEncoded Get Create (RefClass(cComChilkatStringBuilder)) To hoSb1 If (Not(IsComObjectCreated(hoSb1))) Begin Send CreateComObject of hoSb1 End Get ComDecodeAndAppend Of hoSb1 sNameWindows1252UrlEncoded "url" "windows-1252" To iSuccess Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End // Here's how to send an HTTP GET where the param is the utf-8 representation that is URL encoded. // For example: https://www.chilkatsoft.com/something?name=M%C3%A6RSK Get Create (RefClass(cComChilkatStringBuilder)) To hoSbUrl If (Not(IsComObjectCreated(hoSbUrl))) Begin Send CreateComObject of hoSbUrl End Get ComAppend Of hoSbUrl "https://www.chilkatsoft.com/something?name=" To iSuccess Get ComGetEncoded Of hoSb1 "url" "utf-8" To sTemp1 Get ComAppend Of hoSbUrl sTemp1 To iSuccess Get ComGetAsString Of hoSbUrl To sTemp1 Showln sTemp1 Get ComGetAsString Of hoSbUrl To sTemp1 Get ComQuickGetStr Of hoHttp sTemp1 To sResponseBody // Here's how to send an HTTP GET where the param is the windows-1252 representation that is URL encoded. // For example: https://www.chilkatsoft.com/something?name=M%E6RSK Send ComClear To hoSbUrl Get ComAppend Of hoSbUrl "https://www.chilkatsoft.com/something?name=" To iSuccess Get ComGetEncoded Of hoSb1 "url" "windows-1252" To sTemp1 Get ComAppend Of hoSbUrl sTemp1 To iSuccess Get ComGetAsString Of hoSbUrl To sTemp1 Showln sTemp1 Get ComGetAsString Of hoSbUrl To sTemp1 Get ComQuickGetStr Of hoHttp sTemp1 To sResponseBody End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.