1. Go to this page and download the library: Download classy-org/classy-php-sdk 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/ */
classy-org / classy-php-sdk example snippets
$client = new \Classy\Client([
'client_id' => 'your_client_id',
'client_secret' => 'your_client_secret',
'version' => '2.0' // version of the API to be used
]);
$session = $client->newAppSession();
// Get information regarding the campaign #1234
$campaign = $client->get('/campaigns/1234', $session);
// Access the campaign goal: $campaign->goal
// Unpublish the campaign
$client->post('/campaign/1234/deactivate', $session);
if ($session->expired()) {
$client->refresh($session)
}
// $session->expired() is now false.
$client = new \Classy\Client([
'client_id' => 'your_client_id',
'client_secret' => 'your_client_secret',
'version' => '2.0' // version of the API to be used
]);
// Retrieve the session from a file
$session = unserialize(file_get_contents("path/to/a/cache/file"));
// ... work with the API...
// Save the session for later
file_put_contents("path/to/a/cache/file", serialize($session));
try {
$response = $client->get('/endpoint', $session);
} catch (\Classy\Exceptions\APIResponseException $e) {
// Get the HTTP response code
$code = $e->getCode();
// Get the response content
$content = $e->getResponseData();
// Get the response headers
$headers = $e->getResponseHeaders();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.