1. Go to this page and download the library: Download convertkit/convertkitapi library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
convertkit / convertkitapi example snippets
// Require the autoloader (if you're using a PHP framework, this may already be done for you).
oauth_client_id>',
clientSecret: '<your_oauth_client_secret>'
);
// Redirect to begin the OAuth process.
header('Location: '.$api->get_oauth_url('<your_redirect_uri>'));
$result = $api->add_subscriber_to_form(12345, '[email protected]');
$code = $api->getResponseInterface()->getStatusCode(); // 200 OK if e.g. a subscriber already added to the specified form, 201 Created if the subscriber added to the specified form for the first time.
$result = $api->add_subscriber_to_form(12345, '[email protected]');
$api->getResponseInterface()->hasHeader('Content-Length'); // Check if the last API request
// Require the autoloader (if you're using a PHP framework, this may already be done for you).
', '<your_secret_api_key>');
// Errors will be thrown as Guzzle's ClientException or ServerException.
try {
$forms = $api->form_subscribe('invalid-form-id');
} catch (GuzzleHttp\Exception\ClientException $e) {
// Handle 4xx client errors.
// For ClientException, it's possible to inspect the API's JSON response
// to output an error or handle it accordingly.
$error = json_decode($e->getResponse()->getBody()->getContents());
die($error->message); // e.g. "Entity not found".
} catch (GuzzleHttp\Exception\ServerException $e) {
// Handle 5xx server errors.
die($e->getMessage());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.