![]() |
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
(Unicode C) Example: Http.ExtractMetaRefreshUrl methodDemonstrates the
#include <C_CkHttpW.h> #include <C_CkStringBuilderW.h> void ChilkatSample(void) { BOOL success; HCkHttpW http; HCkStringBuilderW sb; BOOL bCrlf; const wchar_t *url; success = FALSE; http = CkHttpW_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 = CkStringBuilderW_Create(); bCrlf = TRUE; CkStringBuilderW_AppendLine(sb,L"<!DOCTYPE html>",bCrlf); CkStringBuilderW_AppendLine(sb,L"<html lang=\"en\">",bCrlf); CkStringBuilderW_AppendLine(sb,L"<head>",bCrlf); CkStringBuilderW_AppendLine(sb,L" <meta charset=\"utf-8\" />",bCrlf); CkStringBuilderW_AppendLine(sb,L" <meta http-equiv=\"refresh\" content=\"5; url=https://example.com\" />",bCrlf); CkStringBuilderW_AppendLine(sb,L" <title>Meta Refresh Redirect</title>",bCrlf); CkStringBuilderW_AppendLine(sb,L"</head>",bCrlf); CkStringBuilderW_AppendLine(sb,L"<body>",bCrlf); CkStringBuilderW_AppendLine(sb,L" <p>Redirecting to example.com in 5 seconds�</p>",bCrlf); CkStringBuilderW_AppendLine(sb,L"</body>",bCrlf); CkStringBuilderW_AppendLine(sb,L"</html>",bCrlf); url = CkHttpW_extractMetaRefreshUrl(http,CkStringBuilderW_getAsString(sb)); if (CkHttpW_getLastMethodSuccess(http) == FALSE) { wprintf(L"The HTML has no META refresh tag.\n"); } else { wprintf(L"META refresh URL: %s\n",url); } CkHttpW_Dispose(http); CkStringBuilderW_Dispose(sb); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.