Created
August 15, 2014 07:51
-
-
Save pkpio/cabc240097734e09e4e9 to your computer and use it in GitHub Desktop.
SMS sending script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Your authentication key | |
| $authKey = "4187AFDl0tFG53ebc36e"; | |
| //Multiple mobiles numbers seperated by comma | |
| $mobileNumber = "8828829765"; | |
| //Sender ID,While using route4 sender id should be 6 characters long. | |
| $senderId = "testid"; | |
| //Your message to send, Add URL endcoding here. | |
| $message = urlencode("This is from code :)"); | |
| //Define route | |
| $route = "default"; | |
| /****** Fixed code **************/ | |
| //Prepare you post parameters | |
| $postData = array( | |
| 'authkey' => $authKey, | |
| 'mobiles' => $mobileNumber, | |
| 'message' => $message, | |
| 'sender' => $senderId, | |
| 'route' => $route | |
| ); | |
| //API URL | |
| $url="http://sms.ssdindia.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 | |
| )); | |
| //get response | |
| $output = curl_exec($ch); | |
| curl_close($ch); | |
| /****** End of fixed code **************/ | |
| echo $output; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment