Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. <?php
  2. //require 'vendor/autoload.php';
  3.  
  4. // Without Composer (and instead of "require 'vendor/autoload.php'"):
  5. require("sendpulse-rest-api-php/src/ApiInterface.php");
  6. require("sendpulse-rest-api-php/src/ApiClient.php");
  7. require("sendpulse-rest-api-php/src/Storage/TokenStorageInterface.php");
  8. require("sendpulse-rest-api-php/src/Storage/FileStorage.php");
  9. require("sendpulse-rest-api-php/src/Storage/SessionStorage.php");
  10. require("sendpulse-rest-api-php/src/Storage/MemcachedStorage.php");
  11. require("sendpulse-rest-api-php/src/Storage/MemcacheStorage.php");
  12.  
  13. use Sendpulse\RestApi\ApiClient;
  14. use Sendpulse\RestApi\Storage\FileStorage;
  15.  
  16. // API credentials from https://login.sendpulse.com/settings/#api
  17. define('API_USER_ID', 'c8c1749f2e0044b8978a0fba698b4c5b');
  18. define('API_SECRET', 'f792ebb151f5eead371c7290320ddebd');
  19. define('PATH_TO_ATTACH_FILE', __FILE__);
  20.  
  21. $SPApiClient = new ApiClient(API_USER_ID, API_SECRET, new FileStorage());
  22.  
  23. /*
  24. * Example: Get Mailing Lists
  25. */
  26. var_dump($SPApiClient->listAddressBooks());
  27.  
  28. /*
  29. * Example: Add new email to mailing lists
  30. */
  31. $ema = $_POST['email'];
  32. echo $ema;
  33. $bookID = 2476246;
  34. $emails = array(
  35. array(
  36. 'email' => $ema,
  37. )
  38. );
  39. //$additionalParams = array(
  40. // 'confirmation' => 'force',
  41. // 'sender_email' => 'sender@example.com',
  42. //);
  43. // With confirmation
  44. //var_dump($SPApiClient->addEmails($bookID, $emails, $additionalParams));
  45.  
  46. // Without confirmation
  47. var_dump($SPApiClient->addEmails($bookID, $emails));
  48. echo "Good";
  49. header('Refresh: 1; url=https://englishpie.ru/'); //редирект через 1 секунду
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement