Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. <?php
  2.  
  3. /******************************************************
  4.  
  5. SMS Notification Sample Script for Webhook
  6. Using your SMS API Provider
  7. Elton - JotForm Support
  8. www.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 = "YourAuthKey";
  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();
  39. curl_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
  48. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  49. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  50.  
  51. //get response
  52. $output = curl_exec($ch);
  53.  
  54. //Print error if any
  55. if(curl_errno($ch))
  56. {
  57.     echo 'error:' . curl_error($ch);
  58. }
  59.  
  60. curl_close($ch);
  61. echo $output;
  62. ?>