![]() |
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
(PureBasic) Example: Http.ExtractMetaRefreshUrl methodDemonstrates the
IncludeFile "CkStringBuilder.pb" IncludeFile "CkHttp.pb" Procedure ChilkatExample() success.i = 0 http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; 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.i = CkStringBuilder::ckCreate() If sb.i = 0 Debug "Failed to create object." ProcedureReturn EndIf bCrlf.i = 1 CkStringBuilder::ckAppendLine(sb,"<!DOCTYPE html>",bCrlf) CkStringBuilder::ckAppendLine(sb,"<html lang=" + Chr(34) + "en" + Chr(34) + ">",bCrlf) CkStringBuilder::ckAppendLine(sb,"<head>",bCrlf) CkStringBuilder::ckAppendLine(sb," <meta charset=" + Chr(34) + "utf-8" + Chr(34) + " />",bCrlf) CkStringBuilder::ckAppendLine(sb," <meta http-equiv=" + Chr(34) + "refresh" + Chr(34) + " content=" + Chr(34) + "5; url=https://example.com" + Chr(34) + " />",bCrlf) CkStringBuilder::ckAppendLine(sb," <title>Meta Refresh Redirect</title>",bCrlf) CkStringBuilder::ckAppendLine(sb,"</head>",bCrlf) CkStringBuilder::ckAppendLine(sb,"<body>",bCrlf) CkStringBuilder::ckAppendLine(sb," <p>Redirecting to example.com in 5 seconds�</p>",bCrlf) CkStringBuilder::ckAppendLine(sb,"</body>",bCrlf) CkStringBuilder::ckAppendLine(sb,"</html>",bCrlf) url.s = CkHttp::ckExtractMetaRefreshUrl(http,CkStringBuilder::ckGetAsString(sb)) If CkHttp::ckLastMethodSuccess(http) = 0 Debug "The HTML has no META refresh tag." Else Debug "META refresh URL: " + url EndIf CkHttp::ckDispose(http) CkStringBuilder::ckDispose(sb) ProcedureReturn EndProcedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.