PHP code example of campaignmonitor / createsend-php
1. Go to this page and download the library: Download campaignmonitor/createsend-php 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/ */
campaignmonitor / createsend-php example snippets
$authorize_url = CS_REST_General::authorize_url(
'Client ID for your application',
'Redirect URI for your application',
'The permission level your application
$result = CS_REST_General::exchange_token(
'Client ID for your application',
'Client Secret for your application',
'Redirect URI for your application',
'A unique code for your user' # Get the code parameter from the query string
);
if ($result->was_successful()) {
$access_token = $result->response->access_token;
$expires_in = $result->response->expires_in;
$refresh_token = $result->response->refresh_token;
# Save $access_token, $expires_in, and $refresh_token.
} else {
echo 'An error occurred:\n';
echo $result->response->error.': '.$result->response->error_description."\n";
# Handle error...
}