I want to use this http://smsalert.no/systorsmsvarious/systorsmsvarious.asmx?op=SendMessageToMobile to send message from magento after user submit form but I dont know how to call and pass parameters to sms function. Please help me. Thanks
-
Have a look in to the answers on stack-overflow. Its useful http://stackoverflow.com/questions/29729179/sms-integration-with-magento-api – Parveen Shukhala Jan 07 '16 at 05:44
-
I am not sure if you have tried this extension https://magecomp.com/magento-sms-notification.html – Gaurav Jain Apr 13 '17 at 11:15
1 Answers
The page tells you that you can use a SOAP-call or an HTTP request with both GET or POST methods. So, you can set up a SoapClient, which requires some additional knowledge.
Using HTTP GET
The easiest method to send an SMS message seems to be calling this URL with correct GET parameters sMobileNumer, sMessage, sUser and sPass.
http://smsalert.no/systorsmsvarious/systorsmsvarious.asmx/SendMessageToMobile?sMobileNumber=string&sMessage=string&sUser=string&sPass=string
Calling URLs in PHP can be done with:
http://php.net/manual/en/function.file-get-contents.php
By the way: You should run some tests with special characters if there will be some of them included in sMessage.
Using SOAP
If you want to use this service through SOAP, you'll get some answers there: How to make a PHP SOAP call using the SoapClient class
I'm unable to test it because I don't have an account for this service, but the code should be similar to this:
/* Initialize webservice with your WSDL */
$client = new SoapClient("http://smsalert.no/systorsmsvarious/systorsmsvarious.asmx?wsdl");
/* Set your parameters for the request */
$params = array(
"sMobileNumber" => "0123456789",
"sMessage" => "Your message",
"sUser" => "username",
"sPass" => "password"
);
/* Invoke webservice method with your parameters, in this case: SendMessageToMobile */
$response = $client->__soapCall("SendMessageToMobile", $params);
/* Print webservice response */
var_dump($response);
The $response variable will tell you if everything went good, or if there have been some errors.