Author Topic: can a php script used for sending sms ?  (Read 7722 times)

0 Members and 1 Guest are viewing this topic.

pllaybuoy

  • Guest
Re: can a php script used for sending sms ?
« Reply #15 on: November 07, 2012, 10:50:12 am »
Well I was drawing some concepts about this similar idea that I had, might as well say it now...
There are those USB adapter for the SIM card, which you put in, plug the adapter to your computer and with the help of included software you can send messages I think.
So if you can do that, you could most likely find/write a custom driver/application to interact with the dongle and have an automated SMS sending daemon.
But I am very unsure if that would work, because it's mainly designed for data transfer.
Another idea is that you could have a cheap dumb-phone connected via USB to your computer and with the help of software like MOBILEdit send messages. But I am unsure if it has an API to build on.
Connect a cellphone option  ?bro samsun star 2 allows you to connect it to computer , then run the pc suite in computer and you can operate  everything . call/text somebody from computer and all , but thats not really what I want :/ all I wanted was to code a website that might allow people to send text messages/
and p.s the number@carrier.com didn't work for me

Offline AlexCarter87

  • NULL
  • Posts: 1
  • Cookies: -2
    • View Profile
Re: can a php script used for sending sms ?
« Reply #16 on: January 09, 2013, 08:42:42 am »
Yes there is a chance for that. Get an SMS gaeway, like i did it with Ozeki NG SMS Gateway.
I show you a code how you can send sms using php script.

Code: [Select]
<?php ######################################################## # Login information for the SMS Gateway ######################################################## $ozeki_user = "admin"; $ozeki_password = "abc123"; $ozeki_url = "http://127.0.0.1:9501/api?"; ######################################################## # Functions used to send the SMS message ######################################################## 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: <br>$urltouse<br><br>"; } //Open the URL to send the message $response = httpRequest($urltouse); if ($debug) { echo "Response: <br><pre>". str_replace(array("<",">"),array("&lt;","&gt;"),$response). "</pre><br>"; } return($response); } ######################################################## # GET data from sendsms.html ######################################################## $phonenum = $_POST['recipient']; $message = $_POST['message']; $debug = true; ozekiSend($phonenum,$message,$debug); ?>


Hope it helps some of you.
« Last Edit: January 09, 2013, 08:47:46 am by AlexCarter87 »