Guest User

Untitled

a guest
Feb 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. add_action('user_register', 'send_new_user', 10, 1);
  2.  
  3. function send_new_user ($user_id){
  4.  
  5. $new_user = get_userdata($user_id);
  6. $useremail = $new_user -> user_email;
  7.  
  8. $url = 'https://api.capsulecrm.com/api/v2/parties';
  9. $body = array(
  10. 'firstName' => 'WhyWontYouWork',
  11. 'email' => $useremail
  12.  
  13. );
  14.  
  15. $args = array(
  16. 'method' => 'POST',
  17. 'timeout' => 45,
  18. 'redirection' => 5,
  19. 'httpversion' => '1.0',
  20. 'sslverify' => false,
  21. 'blocking' => false,
  22. 'headers' => array(
  23. 'Authorization' => 'Bearer {private token goes here!!!!}',
  24. 'Content-Type' => 'application/json',
  25. 'Accept' => 'application/json',
  26. ),
  27. 'body' => json_encode($body),
  28. 'cookies' => array()
  29. );
  30.  
  31. $request = wp_remote_post ($url, $args);
  32. };
Add Comment
Please, Sign In to add comment