Advertisement
Guest User

Untitled

a guest
Aug 4th, 2017
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.58 KB | None | 0 0
  1. <?php
  2.  
  3. $listId = Cake_Api::Call('List', 'Create', array(
  4.     'user_key'      => User::getUserKey(),
  5.     'client_id'     => User::getClientId(),
  6.     'name'          => 'Test Import',
  7.     'sender_name'   => 'Lorem Ipsum',
  8.     'sender_email'  => 'lorem@ipsum.com'
  9. ));
  10.  
  11. Cake_Api::call('List', 'SetInfo', array(
  12.     'user_key'      => User::getUserKey(),
  13.     'client_id'     => User::getClientId(),
  14.     'list_id'       => $listId,
  15.     'policy'        => 'accepted'
  16. ));
  17.  
  18. Cake_Api::call('List', 'EditStructure', array(
  19.     'user_key'      => User::getUserKey(),
  20.     'client_id'     => User::getClientId(),
  21.     'list_id'       => $listId,
  22.     'action'        => 'add',
  23.     'field'         => 'firstname',
  24.     'type'          => 'text'
  25. ));
  26.  
  27. Cake_Api::call('List', 'Import', array(
  28.     'user_key'      => User::getUserKey(),
  29.     'client_id'     => User::getClientId(),
  30.     'list_id'       => $listId,
  31.     'record'        => array(
  32.         array('email' => 'test@gmail.com', 'firstname' => 'test'),
  33.         array('email' => 'test+2@gmail.com', 'firstname' => 'test2'),
  34.     )
  35. ));
  36.  
  37. $records = Cake_Api::call('List', 'Show', array(
  38.     'user_key'      => User::getUserKey(),
  39.     'client_id'     => User::getClientId(),
  40.     'list_id'       => $listId
  41. ));
  42.  
  43. Cake_Api::call('List', 'Import', array(
  44.     'user_key'      => User::getUserKey(),
  45.     'client_id'     => User::getClientId(),
  46.     'list_id'       => $listId,
  47.     'record'        => array(
  48.         array('email' => 'test@gmail.com', 'firstname' => 'test-updated'),
  49.         array('email' => 'test+2@gmail.com', 'firstname' => 'test2-updated'),
  50.     )
  51. ));
  52.  
  53. $records = Cake_Api::call('List', 'Show', array(
  54.     'user_key'      => User::getUserKey(),
  55.     'client_id'     => User::getClientId(),
  56.     'list_id'       => $listId
  57. ));
  58.  
  59. print '<pre>';
  60. print_r($records);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement