· 5 years ago · Mar 02, 2021, 02:54 AM
1<?php
2
3/*
4 Code snippet to receive Webhook from Elementor Pro Form.
5 Add Webhook in the action after form submit, and make sure
6 you enable Advanced Data. Save this file somewhere in your
7 web hosting and then enter the URL to the file, ie,
8 https://mywebsite.com/sendy-webhook.php
9*/
10
11 $api_key = '<your API key here>';
12 $list_id = '<your list ID here>';
13 $sendy_url = '<sendy installation URL>';
14
15 $postdata = http_build_query(
16 array(
17 'api_key' => $api_key,
18 'list' => $list_id,
19 'email' => $_POST['fields']['email']['value'],
20 'name' => $_POST['fields']['name']['value'],
21 'Mobile' => $_POST['fields']['mobile']['value'], // custom field
22 'subform' => 'yes',
23 'boolean' => 'true'
24 )
25 );
26 $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
27 $context = stream_context_create($opts);
28 $result = file_get_contents($sendy_url.'/subscribe', false, $context);
29