Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Más info: https://youtu.be/BMZcFyFPr_M
- function on_submit( $form, &$abort, $submission ){
- $data = $submission->get_posted_data();
- $url = 'MIURL';
- $apiKey = 'KEY';
- $client = new EspoApiClient($url);
- $client->setApiKey($apiKey);
- // Crear cotización en CRM.
- try {
- $response = $client->request('POST', 'Lead', [
- 'firstName' => $data['your-name'],
- 'emailAddress' => $data['your-email'],
- 'description' => $data['your-subject'] . ': ' . $data['your-message'],
- 'source' => 'Web Site',
- ]);
- } catch (\Exception $e) {
- $errorCode = $e->getCode();
- }
- }
- add_action('wpcf7_before_send_mail', 'on_submit', 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement