renwoshin Posted July 30, 2008 Share Posted July 30, 2008 Hello everyone, Does anyone know how to send an SMS using PHP to a specific port? Upon receipt at this port, the phone will trigger a J2ME application. Can we use the standard Email to SMS gateway to achieve this? (ie. AT&T's is 'txt.att.net') or do we need to use Clickatell's API? thanks very much. Link to comment https://forums.phpfreaks.com/topic/117436-use-php-to-send-sms-to-specific-port-using-email-to-sms-gateway/ Share on other sites More sharing options...
ronnie88 Posted July 30, 2008 Share Posted July 30, 2008 if not I know phone numbers such as tmobile have a email addy like [email protected] but if your using sms gateway form <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> script <?php ######################################################## # Login information for the SMS Gateway ######################################################## $ozeki_user = "admin"; $ozeki_password = "abc123"; $ozeki_url = "http://127.0.0.1:9501/ozeki?"; ######################################################## # Function used to send the SMS message ######################################################## function ozekiSend($phone, $msg){ 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; //Open the URL to send the message $resp = file($urltouse); echo join("\r\n",$resp); } ######################################################## # GET data from sendsms.html ######################################################## $phonenum = $_POST['recipient']; $message = $_POST['message']; ozekiSend($phonenum,$message); ?> SOURCE: http://www.ozekisms.com/php-sms-api-asp-sms-api/index_p_php_q_ow_page_number_e_327opt.html Link to comment https://forums.phpfreaks.com/topic/117436-use-php-to-send-sms-to-specific-port-using-email-to-sms-gateway/#findComment-604044 Share on other sites More sharing options...
renwoshin Posted July 30, 2008 Author Share Posted July 30, 2008 thanks for the response, but my question was more asking how to send to a specific port. I can send an SMS fine to the default SMS application of the phone, but I would like to send it to a specific port (not the default one) so that an application can be triggered upon receipt. i am wondering if it is possible to send to a specific port using the free SMS gateways mentioned in http://en.wikipedia.org/wiki/SMS_gateway like.... mail('[email protected]', ...) except somehow include the port. I tried to send to port 4000 like this => mail('1234567890:[email protected]', ...) but i don't think that worked because my application did not pop up. Link to comment https://forums.phpfreaks.com/topic/117436-use-php-to-send-sms-to-specific-port-using-email-to-sms-gateway/#findComment-604050 Share on other sites More sharing options...
ShaunO Posted July 30, 2008 Share Posted July 30, 2008 Is it sent like a standard email? If so you can just change the default SMTP port to whatever you need. Otherwise, if it uses it's own way of sending data you will need to open a socket on that port and send the raw data that the protocol is expecting. Link to comment https://forums.phpfreaks.com/topic/117436-use-php-to-send-sms-to-specific-port-using-email-to-sms-gateway/#findComment-604063 Share on other sites More sharing options...
renwoshin Posted July 30, 2008 Author Share Posted July 30, 2008 hey shaunO, Do you mean changing the php.ini configuration? I tried it (by setting smtp_port=4000 in php.ini, restarting apache, and then using the mail function), but it did not work... in fact, i could still send standard email (the phone could still receive my standard SMS). this probably means the email-to-SMS gateway I used (text.att.net) listens on at least ports 25 & 4000 and sends an SMS to the standard SMS app on the phone. Link to comment https://forums.phpfreaks.com/topic/117436-use-php-to-send-sms-to-specific-port-using-email-to-sms-gateway/#findComment-604086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.