Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

DataFlex Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Bitfinex v2 REST
Bluzone
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Etsy
Facebook
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
MedTunnel

MercadoLibre
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Okta OAuth/OIDC
OneLogin OIDC
OneNote
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
UniPin
VoiceBase
Vonage
Walmart
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yousign
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(DataFlex) SMSAPI - Send SMS with Multiple Lines of Text

See more SMSAPI Examples

Send an SMS message containing multiple lines of text.

For more information, see https://www.smsapi.com/docs/#2-single-sms

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    String sMessageContent
    Handle hoSbMessage
    Variant vSbResponseBody
    Handle hoSbResponseBody
    String sTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Implements the following CURL command:

    // curl -H "Authorization: Bearer token_api_oauth" \
    // "https://api.smsapi.com/sms.do?from=sender_name&to=44123456789&message=message_content&format=json"

    // Use the following online tool to generate HTTP code from a CURL command
    // Convert a cURL Command to HTTP Source Code

    // Adds the "Authorization: Bearer token_api_oauth" header.
    Set ComAuthToken Of hoHttp To "token_api_oauth"

    Move "Hello" + (character(13)) + (character(10)) + "This is a test" + (character(13)) + (character(10)) + "with multiple lines of text." To sMessageContent

    // Given that our message contentn has newlines, we obviously cannot put newlines in a URL without them being URL encoded..
    // Therefore.. URL encode..
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbMessage
    If (Not(IsComObjectCreated(hoSbMessage))) Begin
        Send CreateComObject of hoSbMessage
    End
    Get ComAppend Of hoSbMessage sMessageContent To iSuccess
    Get ComEncode Of hoSbMessage "url" "utf-8" To iSuccess

    Get ComGetAsString Of hoSbMessage To sTemp1
    Get ComSetUrlVar Of hoHttp "msgContent" sTemp1 To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://api.smsapi.com/sms.do?from=sender_name&to=44123456789&message={$msgContent}&format=json" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "Response body:"
    Get ComGetAsString Of hoSbResponseBody To sTemp1
    Showln sTemp1


End_Procedure

 

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