Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

PowerBuilder Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(PowerBuilder) Bunny Sign URL and then Download using Signed URL

See more Bunny CDN Examples

Shows how to sign a URL for BunnyCDN Token Authentication and then use it to download.

For more information, see https://support.bunny.net/hc/en-us/articles/360016055099-How-to-sign-URLs-for-BunnyCDN-Token-Authentication

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
integer li_Success
string ls_MySecurityKey
string ls_Url
oleobject loo_UrlObj
string ls_Url_scheme
string ls_Url_host
string ls_Url_path
oleobject loo_ExpTime
string ls_Expires
oleobject loo_SbToHash
string ls_Token
oleobject loo_SbSignedUrl
string ls_SignedUrl
oleobject loo_Http

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

ls_MySecurityKey = "e7ea8d73-8fa0-44ef-a2cc-91526f7df5ed"

ls_Url = "https://test.b-cdn.net/sample-pdf-with-images.pdf"

// Extract the URL components.
loo_UrlObj = create oleobject
li_rc = loo_UrlObj.ConnectToNewObject("Chilkat_9_5_0.Url")
if li_rc < 0 then
    destroy loo_UrlObj
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_UrlObj.ParseUrl(ls_Url)

ls_Url_scheme = "https"
if loo_UrlObj.Ssl = 0 then
    ls_Url_scheme = "http"
end if

ls_Url_host = loo_UrlObj.Host
ls_Url_path = loo_UrlObj.Path

// Calculate an expiration time 1 hour from the current date/time.
loo_ExpTime = create oleobject
li_rc = loo_ExpTime.ConnectToNewObject("Chilkat_9_5_0.CkDateTime")

loo_ExpTime.SetFromCurrentSystemTime()
loo_ExpTime.AddSeconds(3600)
ls_Expires = loo_ExpTime.GetAsUnixTimeStr(0)

Write-Debug "Expires = " + ls_Expires

// Create the string to hash
loo_SbToHash = create oleobject
li_rc = loo_SbToHash.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_SbToHash.Append(ls_MySecurityKey)
loo_SbToHash.Append(ls_Url_path)
loo_SbToHash.Append(ls_Expires)

// Base64Url encoding is the same as base64, except "-" is used instead of "+",
// "_" is used instead of "/", and no "=" padding is added.
ls_Token = loo_SbToHash.GetHash("sha256","base64Url","utf-8")

loo_SbSignedUrl = create oleobject
li_rc = loo_SbSignedUrl.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_SbSignedUrl.Append(ls_Url_scheme)
loo_SbSignedUrl.Append("://")
loo_SbSignedUrl.Append(ls_Url_host)
loo_SbSignedUrl.Append(ls_Url_path)
loo_SbSignedUrl.Append("?token=")
loo_SbSignedUrl.Append(ls_Token)
loo_SbSignedUrl.Append("&expires=")
loo_SbSignedUrl.Append(ls_Expires)

ls_SignedUrl = loo_SbSignedUrl.GetAsString()
Write-Debug "Signed URL: " + ls_SignedUrl

// Use the signed URL to download the file.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")

li_Success = loo_Http.Download(ls_SignedUrl,"c:/aaworkarea/sample.pdf")
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
else
    Write-Debug "Success."
end if



destroy loo_UrlObj
destroy loo_ExpTime
destroy loo_SbToHash
destroy loo_SbSignedUrl
destroy loo_Http

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.