PHP code example of list-interop / convertkit-client
1. Go to this page and download the library: Download list-interop/convertkit-client 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/ */
list-interop / convertkit-client example snippets
use ListInterop\ConvertKit\Client;
use ListInterop\ConvertKit\Exception\ApiError;
use ListInterop\ConvertKit\Exception\ConvertKitError;
use ListInterop\ConvertKit\Exception\RequestFailure;
assert($client instanceof Client);
$formId = 123; // Retrieve this from the dashboard or by inspecting the forms returned by the api.
try {
$client->subscribeToForm($formId, '[email protected]', 'Fred', ['tag 1', 'tag 2']);
} catch (RequestFailure $error) {
// Network error - can't reach ConvertKit
} catch (ApiError $error) {
// Something was wrong with the values provided, or your API key was wonky
// i.e. The API rejected your request
} catch (ConvertKitError $error) {
// Generic Error, Assertion failed etc.
// All exceptions implement this interface, Providing an invalid email address will get you here.
}