Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. // function mailtrap($phpmailer) {
  2. // $phpmailer->isSMTP();
  3. // $phpmailer->Host = 'smtp.mailtrap.io';
  4. // $phpmailer->SMTPAuth = true;
  5. // $phpmailer->Port = 2525;
  6. // $phpmailer->Username = '99392d7b3447bc';
  7. // $phpmailer->Password = 'ba169f50aac147';
  8. // }
  9.  
  10. // add_action('phpmailer_init', 'mailtrap');
  11.  
  12. /*
  13. Enviando contato para a gestão de Leads do Eleve Crm
  14. */
  15. add_action('wpcf7_before_send_mail', 'wpcf7_to_web_service');
  16. function wpcf7_to_web_service ($WPCF7_ContactForm) {
  17.  
  18. $submission = WPCF7_Submission::get_instance();
  19.  
  20. $posted_data =& $submission->get_posted_data();
  21.  
  22. if(!empty($posted_data))
  23. {
  24. if (isset($posted_data['form_anuncie']) && $posted_data['form_anuncie'] == 1)
  25. {
  26. $api_url = ELEVE_API_URL;
  27.  
  28. $data_contato['nome_lead'] = $posted_data['nome'];
  29. $data_contato['email_lead'] = $posted_data['email'];
  30. $data_contato['telefone_lead'] = $posted_data['telefone'];
  31. $data_contato['token_conta'] = '7ddd2a9ce10a709';
  32. $data_contato['origem_lead'] = 'anuncio-portal-contabil';
  33.  
  34. $expectativa = array(
  35. 'campo' => 'Expectativa',
  36. 'campo_slug' => 'expectativa',
  37. 'valor' => $posted_data['expectativa']
  38. );
  39.  
  40. $empresa = array(
  41. 'campo' => 'Empresa',
  42. 'campo_slug' => 'empresa',
  43. 'valor' => $posted_data['empresa']
  44. );
  45.  
  46. $data_contato['custom'] = array($expectativa, $empresa);
  47.  
  48. $args = array(
  49. 'body' => $data_contato,
  50. 'timeout' => '5',
  51. 'redirection' => '5',
  52. 'httpversion' => '1.0',
  53. 'blocking' => true,
  54. 'headers' => array('Content-Type: application/json'),
  55. 'cookies' => array()
  56. );
  57.  
  58. $response = wp_remote_post( $api_url, $args );
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement