-
Notifications
You must be signed in to change notification settings - Fork 0
/
WLMarpReach.php
48 lines (40 loc) · 1.48 KB
/
WLMarpReach.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
WLMarpReach.php: WishListMember and Sendy Integration
Written by Blaine Moore
Version: 1.0
Before using this script, you must set your installation URL:
*/
$sendy_installation_url = 'https://mysendydomain.com'; // your Sendy installation URL, without the trailing slash
/*
Directions:
1. In WLM, navigate to Integration -> AutoResponder
2. Set your AutoResponder Provider to: arpReach
3. Paste the URL to this file followed by: ?list=XXXXXXXX
+ XXXXXXXXX should be the "short" version of the list ID, found on the "View All Lists" page
+ Example: https://m.jjfast2.com/custom/webhooks/WLMarpReach.php?list=AmtundC1yOIjCdZCeY763JGQ
4. Check the "Unsubscribe if Removed from Level" box if desired
5. Update your AutoResponder Settings
***************************
Do Not Edit Below This Line
***************************
*/
$list = $_GET['list'];
//POST variables
$name = $_POST['first_name'] ." ". $_POST['last_name'];
$email = $_POST['email_address'];
$boolean = 'true';
//Subscribe
$postdata = http_build_query(
array(
'name' => $name,
'email' => $email,
'list' => $list,
'boolean' => 'true'
)
);
$opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
$context = stream_context_create($opts);
$result = file_get_contents($sendy_installation_url.'/'.((1==$_POST['unsubscribe'])?'un':'').'subscribe', false, $context);
echo $result;
?>