Bulk SMS API Documentation (Single/Multiple SMS Via HTTP) For Website/Software Integration
Parameters | Description |
username | Your Login Username Of sendpk.com (Required). |
password | Your Login Password Of sendpk.com (Required). |
sender | Your Company Name/Brand Name (Required).. |
mobile | Recepient Mobile Number (Required). |
network | The Network Parameter Is Optional. Expected Values: Jazz, Zong, Ufone, Telenor. Use It To Send Sms On Ported/MNP/Converted Numbers Or Send Message From A Specific Network Operator |
message | The Message For Recepient (Required). if you are using fixed-sms then pass a json string with your keys & values Example: {"name":"Umair", "pin":"456723"} for more details: Check out Fixed-SMS-Templates. |
template_id | for fixed-sms please type your approved template ID (OPTIONAL) |
type | Type = unicode for unicode SMS (OPTIONAL). | date | dd-mm-YYYY Example:25-02-2016 (For Schedule SMS) (OPTIONAL). | time | hh:mm:ss Example:21:30:55 (For Schedule SMS) (OPTIONAL). | format | Type is xml and json. Not Case sensitive. If set, the result will be returned according to the type specified (OPTIONAL). |
Status Code | Description |
OK | Message Was Successfully Accepted For Delivery. |
1 | Username Or Password Is Either Invalid Or Disabled. |
2 | Username Is Empty. |
3 | Password Is Empty. |
4 | Sender ID Is Empty. | 5 | Recepient Is Empty. | 6 | Message Is Empty. | 7 | Invalid Recepient. | 8 | Insufficient Credit. | 9 | SMS Rejected. |
<?php $username = "923*****";///Your Username $password = "*****";///Your Password $mobile = "923001234567";///Recepient Mobile Number $sender = "SenderID"; $message = "Test SMS From sendpk.com"; ////sending sms $post = "sender=".urlencode($sender)."&mobile=".urlencode($mobile)."&message=".urlencode($message).""; $url = "https://sendpk.com/api/sms.php?username=".$username."&password=".$password.""; $ch = curl_init(); $timeout = 10; // set to zero for no timeout curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $result = curl_exec($ch); /*Print Responce*/ echo $result; ?>
using System; using System.Net; using System.Web; public class Program { public static void Main() { string MyUsername = "userxxx"; //Your Username At Sendpk.com string MyPassword = "92***"; //Your Password At Sendpk.com string toNumber = "923****"; //Recepient cell phone number with country code string Masking = "SMS Alert"; //Your Company Brand Name string MessageText = "SMS Sent using .Net"; string jsonResponse = SendSMS(Masking, toNumber, MessageText, MyUsername , MyPassword); Console.Write(jsonResponse); //Console.Read(); //to keep console window open if trying in visual studio } public static string SendSMS(string Masking, string toNumber, string MessageText, string MyUsername , string MyPassword) { String URI = "http://sendpk.com" + "/api/sms.php?" + "username=" + MyUsername + "&password=" + MyPassword + "&sender=" + Masking + "&mobile=" + toNumber + "&message=" + Uri.UnescapeDataString(MessageText); // Visual Studio 10-15 "//&message=" + System.Net.WebUtility.UrlEncode(MessageText);// Visual Studio 12 try { WebRequest req = WebRequest.Create(URI); WebResponse resp = req.GetResponse(); var sr = new System.IO.StreamReader(resp.GetResponseStream()); return sr.ReadToEnd().Trim(); } catch (WebException ex) { var httpWebResponse = ex.Response as HttpWebResponse; if (httpWebResponse != null) { switch (httpWebResponse.StatusCode) { case HttpStatusCode.NotFound: return "404:URL not found :" + URI; break; case HttpStatusCode.BadRequest: return "400:Bad Request"; break; default: return httpWebResponse.StatusCode.ToString(); } } } return null; } }
Above HTTP API Code Are Fully Compatible With PHP , ASP , Dot Net , JSP , C# , XML , Java Integration
NTN: 6396772 SENDPK.COM |
© Copyright 2014-2024 : SendPK.Com | Search Engine Optimization Done By SendPK.Com |