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
(C) Parse a URL into its Component PartsDemonstrates how to parse a URL into it's component parts.
#include <C_CkUrl.h> void ChilkatSample(void) { HCkUrl url; const char *urlStr; BOOL success; url = CkUrl_Create(); urlStr = "https://www.amazon.com/Anarchy-State-Utopia-Robert-Nozick/dp/0465051006/ref=sr_1_1?s=books&ie=UTF8&qid=1430344305&sr=1-1&keywords=nozick#frag123"; success = CkUrl_ParseUrl(url,urlStr); // Assume success.. printf("URL: %s\n",urlStr); printf("Host: %s\n",CkUrl_host(url)); printf("Port: %d\n",CkUrl_getPort(url)); printf("HostType: %s\n",CkUrl_hostType(url)); printf("Ssl: %d\n",CkUrl_getSsl(url)); printf("Path: %s\n",CkUrl_path(url)); printf("Query: %s\n",CkUrl_query(url)); printf("Frag: %s\n",CkUrl_frag(url)); printf("----\n"); urlStr = "http://matt:secret@www.chilkatsoft.com:8080/somepath.asp?test=123&size=2"; success = CkUrl_ParseUrl(url,urlStr); // Assume success.. printf("URL: %s\n",urlStr); printf("Host: %s\n",CkUrl_host(url)); printf("Port: %d\n",CkUrl_getPort(url)); printf("HostType: %s\n",CkUrl_hostType(url)); printf("Ssl: %d\n",CkUrl_getSsl(url)); printf("Login: %s\n",CkUrl_login(url)); printf("Password: %s\n",CkUrl_password(url)); printf("Path: %s\n",CkUrl_path(url)); printf("Query: %s\n",CkUrl_query(url)); printf("Frag: %s\n",CkUrl_frag(url)); CkUrl_Dispose(url); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.