Official Site
click here to view our new site launched
Showing posts with label Make use of SMS API's. Show all posts
Showing posts with label Make use of SMS API's. Show all posts
Friday, April 27, 2012
WAYSMS API PHP
function sendSMS($url) {
$userAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);
$html = curl_exec($ch);
if (!$html) {
echo "
CURL Page: " . $url;
echo "
CURL Error Number: " . curl_errno($ch);
echo "
CURL Error Desc: " . curl_error($ch);
return FALSE;
} else {
return trim($html);
}
}
// Note: provider can be changed by setting $provider to any of the provider say 'fullonsms'
$toMobile ='Recipient number';
$message=urlencode("hello world");
$uid='Your mobile no';
$password='Password';
$provider='way2sms';
$url="http://ubaid.tk/sms/sms.aspx?uid=$uid&pwd=$password&msg=$message&phone=$toMobile&provider=$provider";
if(sendSMS($url)=='1')
echo'\n Message sent...!';
/* Note:
List of Providers: way2sms, fullonsms, smsindia, whozzat, smsinside, site2sms
*/
Tuesday, January 3, 2012
Make use of SMS API's
Just we need to have the account in one of the following sms provider.
uid=” + uid + “&pwd=” + password + “&msg=” + message + “&phone=” + no + “&provider=way2sms”
Your can use cURL for PHP
C# CODE: The Source Code example given below is in C# and can be used in any .NET Application directly.
public void send(string uid, string password, string message, string no) { HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(“http://ubaid.tk/sms/sms.aspx?uid=” + uid + “&pwd=” + password + “&msg=” + message + “&phone=” + no + “&provider=way2sms”); HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse(); System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream()); string responseString = respStreamReader.ReadToEnd(); respStreamReader.Close(); myResp.Close(); }
NOTE : Don't forget to use namespaces
NOTE:
- Way2sms : 140 Chars
- Full On SMS : 160 Chars
- SMS India : 160 Chars
- Whozzat : 470 Chars
- SMS Inside : 160 Chars.
- Site 2 SMS : 260 Chars.
- SMSFI.com : 138 Chars.
Today I am going to explain how to use my WAY2SMS API service in your own application.
“http://ubaid.tk/sms/sms.aspx?Your can use cURL for PHP
C# CODE: The Source Code example given below is in C# and can be used in any .NET Application directly.
public void send(string uid, string password, string message, string no) { HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(“http://ubaid.tk/sms/sms.aspx?uid=” + uid + “&pwd=” + password + “&msg=” + message + “&phone=” + no + “&provider=way2sms”); HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse(); System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream()); string responseString = respStreamReader.ReadToEnd(); respStreamReader.Close(); myResp.Close(); }
NOTE : Don't forget to use namespaces
using System.Net;
using System.IO;
using System.IO;
NOTE:
Required Parameters : uid, pwd, phone, msg.
uid : your userid for the required sms provider
pwd : your password for the required sms provider
provider : way2sms(default), fullonsms, smsindia, whozzat, smsinside, site2sms. if you do not specify any provider, way2sms will be used by default.
phone : phone number whom you want to send sms. seperate multiple phone numbers with a comma (,)
msg : your sms message, unlimited chars. will be sent as multiple msgs if crosses the message length for any provider
msg : your sms message, unlimited chars. will be sent as multiple msgs if crosses the message length for any provider
codes : 1. completely optional parameter. send this if you require a user friendly msg from the server.
for example, if codes=1 is not provided the server will return the result as an integer.
Output Flags:
1 means SMS sent,
-1 means some server error,
-2 means invalid username,
-3 means invalid message text,
-4 means login failed.
Currently, the following service providers are supported
Currently, the following service providers are supported
Subscribe to:
Posts (Atom)