Chilkat Examples

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

DataFlex Examples

ASN.1
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
Facebook
FileAccess
Firebase
GMail REST API
GeoOp
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Sheets
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)

Java KeyStore (JKS)
Jira
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
PayPal
Peoplevox
QuickBooks
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Shopify
Socket/SSL/TLS
Spider
Stream
Stripe
SugarCRM
Tar Archive
Twitter
Upload
VoiceBase
Walmart
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Xero
Zip
curl
eBay

 

 

 

(DataFlex) Get a Piece of Information from the LastErrorXml

Demonstrates how to get a bit of information from the LastErrorXml. Suppose you call ftp.DeleteRemoteFile and it fails, and the LastErrorXml property contains the XML as shown below. This example gets the content in the "statusCode" tag.

<ChilkatLog>
  <DeleteRemoteFile>
    <DllDate>Dec 30 2015</DllDate>
    <ChilkatVersion>9.5.0.55</ChilkatVersion>
    <UnlockPrefix>xxx</UnlockPrefix>
    <Username>CHILKAT:Matt</Username>
    <Architecture>Little Endian; 32-bit</Architecture>
    <Language>Visual C++ 11.0 (32-bit)</Language>
    <VerboseLogging>0</VerboseLogging>
    <filename>[does_not_exist.txt]</filename>
    <deleteFile>
      <simplePathCommand>
        <simpleCommand>
          <sendCommand>
            <sendingCommand>DELE does_not_exist.txt</sendingCommand>
          </sendCommand>
          <readCommandResponse>
            <replyLineQP>550 Delete operation failed.</replyLineQP>
          </readCommandResponse>
        </simpleCommand>
        <error>Simple path command failed.</error>
        <statusCode>550</statusCode>
        <reply>550 Delete operation failed.</reply>
      </simplePathCommand>
    </deleteFile>
    <error>Failed.</error>
  </DeleteRemoteFile>
</ChilkatLog>

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoFtp
    Boolean iSuccess
    Handle hoXml
    String sTemp1

    Get Create (RefClass(cComChilkatFtp2)) To hoFtp
    If (Not(IsComObjectCreated(hoFtp))) Begin
        Send CreateComObject of hoFtp
    End

    //  Any string unlocks the component for the 1st 30-days.
    Get ComUnlockComponent Of hoFtp "Anything for 30-day trial" To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoFtp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Set ComHostname Of hoFtp To "ftp.***.com"
    Set ComUsername Of hoFtp To "***"
    Set ComPassword Of hoFtp To "***"

    //  Connect and login to the FTP server.
    Get ComConnect Of hoFtp To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoFtp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    //  Set the current remote directory to where the file is located:
    Get ComDeleteRemoteFile Of hoFtp "does_not_exist.txt" To iSuccess
    If (iSuccess <> True) Begin
        Get Create (RefClass(cComChilkatXml)) To hoXml
        If (Not(IsComObjectCreated(hoXml))) Begin
            Send CreateComObject of hoXml
        End
        Get ComLastErrorXml Of hoFtp To sTemp1
        Get ComLoadXml Of hoXml sTemp1 To iSuccess
        Get ComSearchForTag2 Of hoXml NULL "statusCode" To iSuccess
        If (iSuccess = True) Begin
            Get ComContent Of hoXml To sTemp1
            Showln "statusCode = " sTemp1
        End

        Procedure_Return
    End

    Get ComDisconnect Of hoFtp To iSuccess


End_Procedure

 

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