Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //require 'vendor/autoload.php';
- // Without Composer (and instead of "require 'vendor/autoload.php'"):
- require("sendpulse-rest-api-php/src/ApiInterface.php");
- require("sendpulse-rest-api-php/src/ApiClient.php");
- require("sendpulse-rest-api-php/src/Storage/TokenStorageInterface.php");
- require("sendpulse-rest-api-php/src/Storage/FileStorage.php");
- require("sendpulse-rest-api-php/src/Storage/SessionStorage.php");
- require("sendpulse-rest-api-php/src/Storage/MemcachedStorage.php");
- require("sendpulse-rest-api-php/src/Storage/MemcacheStorage.php");
- use Sendpulse\RestApi\ApiClient;
- use Sendpulse\RestApi\Storage\FileStorage;
- // API credentials from https://login.sendpulse.com/settings/#api
- define('API_USER_ID', 'c8c1749f2e0044b8978a0fba698b4c5b');
- define('API_SECRET', 'f792ebb151f5eead371c7290320ddebd');
- define('PATH_TO_ATTACH_FILE', __FILE__);
- $SPApiClient = new ApiClient(API_USER_ID, API_SECRET, new FileStorage());
- /*
- * Example: Get Mailing Lists
- */
- var_dump($SPApiClient->listAddressBooks());
- /*
- * Example: Add new email to mailing lists
- */
- $ema = $_POST['email'];
- echo $ema;
- $bookID = 2476246;
- $emails = array(
- array(
- 'email' => $ema,
- )
- );
- //$additionalParams = array(
- // 'confirmation' => 'force',
- // 'sender_email' => 'sender@example.com',
- //);
- // With confirmation
- //var_dump($SPApiClient->addEmails($bookID, $emails, $additionalParams));
- // Without confirmation
- var_dump($SPApiClient->addEmails($bookID, $emails));
- echo "Good";
- header('Refresh: 1; url=https://englishpie.ru/'); //редирект через 1 секунду
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement