Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /******************************************************
- SMS Notification Sample Script for Webhook
- Using your SMS API Provider
- Elton - JotForm Support
- www.jotform.com
- ******************************************************/
- //Catch form field values
- $result = $_REQUEST['rawRequest'];
- $obj = json_decode($result, true);
- //Replace your authentication key & credentials
- $authKey = "YourAuthKey";
- $senderId = "102234";
- $route = "default";
- //Replace your form field names
- $mobileNumber = $obj['q1_mobileNo']; //mobile no. from form data
- $message = urlencode($obj['q2_message']); //message from form data
- //Prepare you post parameters
- $postData = array(
- 'authkey' => $authKey,
- 'mobiles' => $mobileNumber,
- 'message' => $message,
- 'sender' => $senderId,
- 'route' => $route
- );
- //Replace your API endpoint
- $url="http://mysmsapiproviders.com/sendhttp.php";
- // init the resource
- $ch = curl_init();
- curl_setopt_array($ch, array(
- CURLOPT_URL => $url,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => $postData
- //,CURLOPT_FOLLOWLOCATION => true
- ));
- //Ignore SSL certificate verification
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- //get response
- $output = curl_exec($ch);
- //Print error if any
- if(curl_errno($ch))
- {
- echo 'error:' . curl_error($ch);
- }
- curl_close($ch);
- echo $output;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment