Can a PHP script (which can be working with a MySQL DB) send and/or receive SMSs using some sort of server-side solution?
Any special server-side application, or special hardware required? And compatibility? Windows, Linux?
Can a PHP script (which can be working with a MySQL DB) send and/or receive SMSs using some sort of server-side solution?
Any special server-side application, or special hardware required? And compatibility? Windows, Linux?
There are plenty of companies like Esendex that offer APIs for sending/receiving SMS messages. I'm not sure if you're looking to send them directly from your hardware though?
You can get usb to gsm modems and send messages from php or any other language or you can develope J2EE programs on cellphones to do the same thing(this is hackier).
The cheapest way to do it(at less that was my experience) was to get a MultiTech GSM module for 50 USD, installed a GSM card with unlimited text and started comunicating using the serial port, very simple commands allows you to send text and the module makes all the protocol conections and stuff...
Basicly you end up using AT commands (they change from modem to modem) but they are like AT#T/"555031231" Sample Text message //
Of course the down side of going with the gsm chip is that you actually have to do some electronics, if you go for the high end gsm modems they have all the solved and you can just plug and play!
If you are in the UK, txtlocal is a good option. They already have example code on their site to get you up and running. Very simple, using curl functions.
To send sms:
Here is a simple function to send sms using CURL:
function CURLsendsms($number, $message_body){
$api_params = $api_element.'?apikey='.$apikey.'&sender='.$sender.'&to='.$mobileno.'&message='.$textmessage;
$smsGatewayUrl = "http://springedge.com";
$smsgatewaydata = $smsGatewayUrl.$api_params;
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_URL, smsgatewaydata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
// Use file get contents when CURL is not installed on server.
if(!$output){
$output = file_get_contents($smsgatewaydata);
}
}
Also you can use php class to send sms http://www.phpclasses.org/package/9522-PHP-Send-SMS-messages-with-Spring-Edge-API.html
There are two files in above class: sendsms.php - Class file to call sms gateway restAPI test.php - Example file to test sms function. This Class is using spring edge sms gateway provider API
To receive sms :
You need to purchase a virtual number which can be 10 digit virtual mobile number or short code number.
Virtual number can be configured with a HTTP URL with params as query string
Ex. example.com/receivesms.php?from=%number%&smstext=%text%
All the messages received on virtual number will be triggered to configured URL so you can process it further (Ex. Storing replies to DB or sending a text message in response) in your script as per requirement.
Virtual mobile number (2 way sms number) can be configured with any sms service provider
© 2022 - 2024 — McMap. All rights reserved.