![]() |
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
(C) Example: Http.ExtractMetaRefreshUrl methodDemonstrates the
#include <C_CkHttp.h> #include <C_CkStringBuilder.h> void ChilkatSample(void) { BOOL success; HCkHttp http; HCkStringBuilder sb; BOOL bCrlf; const char *url; success = FALSE; http = CkHttp_Create(); // Sample HTML with a META refresh. // <!DOCTYPE html> // <html lang="en"> // <head> // <meta charset="utf-8" /> // <meta http-equiv="refresh" content="5; url=https://example.com" /> // <title>Meta Refresh Redirect</title> // </head> // <body> // <p>Redirecting to example.com in 5 seconds�</p> // </body> // </html> sb = CkStringBuilder_Create(); bCrlf = TRUE; CkStringBuilder_AppendLine(sb,"<!DOCTYPE html>",bCrlf); CkStringBuilder_AppendLine(sb,"<html lang=\"en\">",bCrlf); CkStringBuilder_AppendLine(sb,"<head>",bCrlf); CkStringBuilder_AppendLine(sb," <meta charset=\"utf-8\" />",bCrlf); CkStringBuilder_AppendLine(sb," <meta http-equiv=\"refresh\" content=\"5; url=https://example.com\" />",bCrlf); CkStringBuilder_AppendLine(sb," <title>Meta Refresh Redirect</title>",bCrlf); CkStringBuilder_AppendLine(sb,"</head>",bCrlf); CkStringBuilder_AppendLine(sb,"<body>",bCrlf); CkStringBuilder_AppendLine(sb," <p>Redirecting to example.com in 5 seconds�</p>",bCrlf); CkStringBuilder_AppendLine(sb,"</body>",bCrlf); CkStringBuilder_AppendLine(sb,"</html>",bCrlf); url = CkHttp_extractMetaRefreshUrl(http,CkStringBuilder_getAsString(sb)); if (CkHttp_getLastMethodSuccess(http) == FALSE) { printf("The HTML has no META refresh tag.\n"); } else { printf("META refresh URL: %s\n",url); } CkHttp_Dispose(http); CkStringBuilder_Dispose(sb); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.