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

C 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

 

 

 

(C) HTTP POST with some Params in URL and others in application/x-www-form-urlencoded Body

Demonstrates show to send an HTTP POST with some params in the URL, and others in the application/x-www-form-urlencoded Body

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <C_CkHttp.h>
#include <C_CkHttpRequest.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    const char *url;
    HCkHttp http;
    HCkHttpRequest req;
    HCkHttpResponse resp;

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

    // Imagine a URL that contains two params: one named "xyz" and one named "name".
    // We want to send a POST to it, but with 2 additional params in the body of the request.
    // The PostUrlEncoded method cannot be used because it parses the URL and puts all the params
    // in the HTTP body.  The SynchronousRequest method should instead be used so
    // that the req.Path can be explicitly specified.
    url = "http://www.chilkatsoft.com/echoPost.asp?xyz=123&name=matt";

    http = CkHttp_Create();

    // Provide a session log path so we can visually verify the exact request sent.
    // (This is only for debugging purposes.)
    CkHttp_putSessionLogFilename(http,"c:/aaworkarea/httpLog.txt");

    // Create an HTTP request that has two additional params
    req = CkHttpRequest_Create();

    CkHttpRequest_putHttpVerb(req,"POST");
    CkHttpRequest_putPath(req,"/echoPost.asp?xyz=123&name=matt");
    CkHttpRequest_AddParam(req,"sport","tennis");
    CkHttpRequest_AddParam(req,"tournament","French Open");

    // Send the HTTP POST and get the response.
    resp = CkHttp_SynchronousRequest(http,"www.chilkatsoft.com",80,FALSE,req);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        return;
    }

    printf("%s\n",CkHttpResponse_bodyStr(resp));
    CkHttpResponse_Dispose(resp);

    printf("Success.\n");


    CkHttp_Dispose(http);
    CkHttpRequest_Dispose(req);

    }

 

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