Most of the time we add such service(SMS) to our project to enhance it and to add some beautification of the project...
There are two ways by which we can make SMS module to work
1. Using the service like way2SMS or any other..
2. By using a mobile device(Cell phone)
Sending the message by using the third party service is little trick, i.e we need to go for some [b]hackng[/b]
i.e first we need to sign up for the service and when it is sending the message, you should copy the URL and modfiy that URL and paste it into the PHP code and call it when ever you need to use the SMS service, am not sharing must information about the modification of URL and all here..Since they(way2SMS) used to block such trick as they get to know...Some time when we are luck such methods will going to work..Anyway its not a correct and efficent method to use
Sending the SMS from a mobile device like cell phone with GSM connection is more efficient since it is chaep and reliable...But to make this to work, we need to use a third party software called OzeKing..which is available for 30 days trail..We can purchase it, if we are serious into any business with SMS...
The software is availale to download at: http://www.ozekisms.com/index.php?owpn=112
Its basic layout look like this:-
As it can be seen in the figure, here we need to attach a GSM modem(i.e our cell phone) to server system, which makes the call to the network provider(the one which we are using on cell phone), it sends the message to the customers..
In the mean time, connect your cell phone to the computer system, install the drives keep you phone ready..and the most important step here is check the port number to which your phone is connected to..
It can be known by
control panel->phone and modem-> enter zip code->Modems tab will show the com port to which your mobile is connected...
Now install the downloaded software...Start the software, it will open in a default web browser..which will ask you for the username and password, which is taken during the installation.....
Then the main interface appears..click on Add service provider-> GSM/GPRS modem connection..
which will ask you for COM port, message center number, GSM number etc..enter all corect information...especially the COM port should be the one to which you have connected the cell phone..click ok
Now go to compose and write a message, add contact number and send a messgae...If it works correct, then device setup and OzeKing configuration is correct...
NOw how to use it as a part of your project in PHP??
Here is the code to create a form front end and php code to send the SMS
Fornt end:
Quote:<html>
<body>
<h1>My SMS form</h1>
<form method=post action='sendsms.php'>
<table border=0>
<tr>
<td>Recipient</td>
<td><input type='text' name='recipient'></td>
</tr>
<tr>
<td>Message</td>
<td><textarea rows=4 cols=40 name='message'></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type=submit name=submit value=Send></td>
</tr>
</table>
</form>
</body>
</html>
sendsms.php
Quote:########################################################
# Login information for the SMS Gateway
########################################################$ozeki_user = "admin";
$ozeki_password = "admin123";
$ozeki_url = "http://127.0.0.1:9501/api?";function httpRequest($url){
$pattern = "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/";
preg_match($pattern,$url,$args);
$in = "";
$fp = fsockopen("$args[1]", $args[2], $errno, $errstr, 30);
if (!$fp) {
return("$errstr ($errno)");
} else {
$out = "GET /$args[3] HTTP/1.1\r\n";
$out .= "Host: $args[1]:$args[2]\r\n";
$out .= "User-agent: Ozeki PHP client\r\n";
$out .= "Accept: */*\r\n";
$out .= "Connection: Close\r\n\r\n";fwrite($fp, $out);
while (!feof($fp)) {
$in.=fgets($fp, 128);
}
}
fclose($fp);
return($in);
}function ozekiSend($phone, $msg, $debug=false){
global $ozeki_user,$ozeki_password,$ozeki_url;$url = 'username='.$ozeki_user;
$url.= '&password='.$ozeki_password;
$url.= '&action=sendmessage';
$url.= '&messagetype=SMS:TEXT';
$url.= '&recipient='.urlencode($phone);
$url.= '&messagedata='.urlencode($msg);$urltouse = $ozeki_url.$url;
if ($debug) { echo "Request:
$urltouse"; }
//Open the URL to send the message
$response = httpRequest($urltouse);
if ($debug) {
echo "Response:
".
str_replace(array("<",">"),array("<",">"),$response).
""; }
return($response);
}$phonenum = $_POST['recipient'];
$message = $_POST['message'];
$debug = true;
ozekiSend($phonenum,$message,$debug);
?>
Now link your project to this form, send the SMS form this HTML form by entering number and message...Since it is a simple HTML form you can manipulate it in the way you want
This is how we can send the SMS from PHP, which can help you in beautification of the project
--Admin
Source: http://www.vtuforum.com/Thread-Send-SMS-from-PHP-using-OzeKing
proposition 8 ricky martin larry bird chauncey billups caucus results exton kurt warner
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.