-
sacredvibesAsked on January 22, 2016 at 11:49 PM
-
sacredvibesReplied on January 23, 2016 at 12:07 AM
The contents of my file are:
<?php
//strip off slashes
function stripslashes_deep($value){
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
//Get form field values
$result = stripslashes_deep($_REQUEST['rawRequest']);
$obj = json_decode($result, true);
//Authentication key & default values
$authKey = "xxxxxxxxxxxxx";
$senderId = “iAlert”;
$route = "1";
//replace your form field names
$mobileNumber = 91$obj['phoneNumber']; //mobile no. from form data
$message = urlencode(Dear $obj['fullName3'] Thnkx fr signing up. ur Passes have been mailed to $obj['email'] ); //message from form data
//Prepare you post parameters
$postData = array(
'authkey' => $authKey,
'mobiles' => $mobileNumber,
'message' => $message,
'sender' => $senderId,
'route' => $route
);
//Replace your API URL
$url="https://control.msg91.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;
?>
Let me know if any changes are Required.
-
Kevin Support Team LeadReplied on January 23, 2016 at 12:25 AM
Hi,
I checked your form and I can see that is similar to the code provided on the example, however, I was able to find an error on it, on this part, you have a number before the variable :
$mobileNumber = 91$obj['phoneNumber']; //mobile no. from form data
Try removing it, it should make a difference, also make sure you are getting the correct fields, if possible share us the link to the form that you are trying to integrate, it would be helpful.
We will wait for your response.
Thanks.
-
sacredvibesReplied on January 27, 2016 at 12:57 PM
I have removed it. :/ Don't see any difference.
-
Mike_G JotForm SupportReplied on January 27, 2016 at 3:00 PM
Can you try if by adding 91 as a string followed by $obj['phoneNumber']; would make any difference? Like this, '91'.$obj['phoneNumber']; or "91".$obj['phoneNumber'];
Let us know if you still not able to receive SMS after that or if there is an error message on your end, as that would be helpful for us to identify the issue.
Thank you.
-
sacredvibesReplied on January 27, 2016 at 11:54 PM
I've tried doing that, and I have also changed the url from https:// to http://
It's still not working. :/
Please help.
-
mert JotForm UI DeveloperReplied on January 28, 2016 at 7:36 AM
Hi there,
You can try to customize the following script. You need to change some of the values like "username", "sender", then you can create your php file and follow the same steps on the guide about WebHooks integration.
<?php
$result = $_REQUEST['rawRequest']);
$obj = json_decode($result, true);
$name = $obj['{input11}']; //name
$mobile = $obj['{xxxxxxxxxx}']; //mobile
$message = $obj['xxxxxxxxxx']; //msg
//Create the SMS URL
$url = 'http://api.itnewsletter.co.il/webServices/WebServiceSMS.asmx?wsdl' . http_build_query(array(
'user' => "name@email.com",
'password' => "Kax9X9",
'accid' => "638",
'mobiles' => $mobile,
'message' => $message,
'sender' => "035333345",
'name' => $name
));
//cURL - load the URL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$content = trim(curl_exec($ch));
curl_close($ch);
?>
Please, do let us know about the results.
Thanks.
-
sacredvibesReplied on January 28, 2016 at 11:00 AM
I am using MSG91. The MSG 91 API Doesn't support usernames and passwords.
The API is as mentioned on their website: https://msg91.com/sms-for-developers
If you visit their page, and go to the PHP Section.. The Sample code there doesn't use any Username or Password.. It only uses the API Key.Please Help ASAP
-
sacredvibesReplied on January 28, 2016 at 11:16 AM
-
MikeReplied on January 28, 2016 at 1:40 PM
There are errors with your mobileNumber and message variables. I would like to recommend you to start debugging with defined values to make sure that your script actually works.
Example:
$mobileNumber = "919999999990"; //replace with your test mobile no.
$message = urlencode("Test message"); //test message
Are you able to get the test messages with these values?
Also, we would like to recommend you to upload the code to some sharing service (e.g. http://code.re or http://pastebin.com) if you need any further assistance on this. Thank you.