Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2. include '../functions.php';
  3. logd('ac_tilda', $_POST);
  4. header('Access-Control-Allow-Origin: *');
  5.  
  6. function activeCampaign_contact_add($email, $phone,$utm_source,$utm_medium,$utm_campaign,$utm_content,$utm_term,$id) {
  7. $params = array(
  8. 'api_key' => ACTIVECAMPAIGN_API_KEY,
  9. 'api_action' => 'contact_add',
  10. 'api_output' => 'serialize',
  11. );
  12.  
  13. $post = array(
  14. 'email' => $email,
  15. 'phone' => $phone,
  16. 'field[%UTM_SOURCE%,0]' => $utm_source,
  17. 'field[%UTM_MEDIUM%,0]' => $utm_medium,
  18. 'field[%UTM_CAMPAIGN%,0]' => $utm_campaign,
  19. 'field[%UTM_CONTENT%,0]' => $utm_content,
  20. 'field[%UTM_TERM%,0]' => $utm_term,
  21. 'p['+$id+']' => $id
  22. );
  23. return makeActiveCampaignPostRequest($params, $post);
  24. }
  25.  
  26. if($_SERVER["REQUEST_METHOD"] == "POST")
  27. {
  28.  
  29. $email = $_POST['Email'];
  30. $phone = $_POST['Phone'];
  31. $id = $_POST['list_id'];
  32.  
  33. $utm_source = $_POST['utm_source'];
  34. $utm_medium = $_POST['utm_medium'];
  35. $utm_campaign = $_POST['utm_campaign'];
  36. $utm_content = $_POST['utm_content'];
  37. $utm_term = $_POST['utm_term'];
  38.  
  39. $result = activeCampaign_contact_add($email,$phone,$utm_source,$utm_medium,$utm_campaign,$utm_content,$utm_term,$id);
  40.  
  41. logd('ac_tilda', 'result');
  42. logd('ac_tilda', $result);
  43. }
  44.  
  45. /*utm_source=yandex
  46. utm_medium=cpc
  47. utm_campaign=promo
  48. utm_content=blocktext
  49. utm_term=poisk */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement