· 6 years ago · Mar 05, 2020, 05:26 PM
1<?php
2
3/******************************************************
4
5SMS Notification Sample Script for Webhook
6Using your SMS API Provider
7Elton - JotForm Support
8www.jotform.com
9
10******************************************************/
11
12//Catch form field values
13$result = $_REQUEST['rawRequest'];
14$obj = json_decode($result, true);
15
16//Replace your authentication key & credentials
17$authKey = "67-NOX2hdt15815727302MEvjJI";
18$senderId = "102234";
19$route = "default";
20
21//Replace your form field names
22$mobileNumber = $obj['q1_mobileNo']; //mobile no. from form data
23$message = urlencode($obj['q2_message']); //message from form data
24
25//Prepare you post parameters
26$postData = array(
27 'authkey' => $authKey,
28 'mobiles' => $mobileNumber,
29 'message' => $message,
30 'sender' => $senderId,
31 'route' => $route
32);
33
34//Replace your API endpoint
35$url="http://mysmsapiproviders.com/sendhttp.php";
36
37// init the resource
38$ch = curl_init();
39curl_setopt_array($ch, array(
40 CURLOPT_URL => $url,
41 CURLOPT_RETURNTRANSFER => true,
42 CURLOPT_POST => true,
43 CURLOPT_POSTFIELDS => $postData
44 //,CURLOPT_FOLLOWLOCATION => true
45));
46
47//Ignore SSL certificate verification
48curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
49curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
50
51//get response
52$output = curl_exec($ch);
53
54//Print error if any
55if(curl_errno($ch))
56{
57 echo 'error:' . curl_error($ch);
58}
59
60curl_close($ch);
61echo $output;
62?>