PHP code example of kazin8 / elopage-php

1. Go to this page and download the library: Download kazin8/elopage-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/ */

    

kazin8 / elopage-php example snippets


/* Get the list of products */ 
$response = $api->get('products');

if ($response->isSuccess()) {
    $data = $response->getData();
} else {
    $error = $response->getError();
}

if ($response->isSuccess()) {
    $data = $response->getData();
} else {
    throw new ElopageApiException($response->getError()->getMessage(), $response->getError()->getCode());
}

$response = $api->get('products', $id);

$response = $api->get('products');

$response = $api->get('publishers');

$payload = [
  'affiliate_program_id' => 1
];

$response = $api->post("publishers/{$id}/enroll", $payload);

$payload = [
  'affiliate_program_id' => 1
];

$response = $api->post("publishers/{$id}/unenroll", $payload);

$response = $api->get('pricing_plans', $id);

$response = $api->delete('pricing_plans', $id);

$response = $api->get('payments', $id);

$response = $api->get('payments', $id);