Hi Friends,

Currently, i'm working on sms processing. I need to create an application to receive and store the sms in database. I have tried this with vb.But i didn't work perfectly.Could anybody help me on how to receive sms and store in php without using any third-party software? Since i'm new to this software development side, I really need help and guidance from the people who knows this well.Tq

Dani AI

Generated

Summary and practical options (short): sending SMS from PHP is easy; receiving SMS requires either a third‑party inbound number with webhooks or local GSM hardware that your server can control. was right that email‑to‑SMS only helps for outbound; was also correct that you need some service unless you manage the GSM endpoint yourself; and ’s USB‑stick approach is a common, workable hardware path. (twilio.com)

Hardware route (no third party): attach a GSM modem or compatible phone to the server, switch it from “storage” to “modem” mode on Linux (usb_modeswitch), set the serial port, and either poll the modem or enable unsolicited SMS notifications and read AT results. Typical AT sequence (text mode + enable notifications then read) looks like:

AT
ATE0
AT+CMGF=1           // text mode
AT+CNMI=1,2,0,1,0   // enable incoming message indications (params vary by modem)
+ CMTI: "SM",3      // unsolicited arrival -> read index 3
AT+CMGR=3           // read message
AT+CMGD=3           // delete message

AT/CNMI/CMGR/CMGL behavior is defined by the modem’s AT command set (3GPP / vendor docs) so check the device manual. For mode switching on Linux see usb_modeswitch; for ready daemons that handle modems and call scripts (so you don’t parse AT yourself) see projects like SMS Server Tools 3 or Gammu (both can invoke a PHP script on receive). (manuals.plus)

Webhook (third‑party) route: buy an inbound SMS number from a provider (Twilio, Vonage, etc.). The provider POSTs message fields (From, Body, etc.) to a PHP URL — then insert into your DB with PDO. Example handler:

$from = $_POST['From'] ?? '';
$body = $_POST['Body'] ?? '';
$stmt = $pdo->prepare('INSERT INTO sms_inbox (sender, body, received_at) VALUES (?, ?, NOW())');
$stmt->execute([$from, $body]);

Providers give reliable delivery, global reach and avoid hardware headaches. (twilio.com)

Quick checklist / cautions: ensure SIM/account can receive SMS, choose a modem known to work long‑term (phones often fail under heavy use), handle Unicode and multipart messages (may require PDU mode), guard against duplicates, run modem access with correct permissions/udev rules, and add logging/retries. If low effort is desired use a webhook provider; if no third party is allowed, use a GSM modem + Gammu/smstools and have them call your PHP processing script. (docs.gammu.org)

Recommended Answers

All 4 Replies

Not possible without a third party (unless you own your own wireless company with their own network)

This has been covered many times in this forum. You can do a search on SMS and you should find a bunch of previous posts. In a nutshell you can send an SMS like an email as long as you know the cell phone provider, the person's cell phone address and the email address format for SMS messages used by that provider. The format will be something like where nnnnnnnnn is the phone number and the rest is defined by the cell phone provider.

You can't receive SMS messages in your program without subscribing to an SMS message service who can provide the 2 way connection. If you do that, then you won't need to know the cell phone provider in order to send a message (the SMS message service will figure that out).

Please I've been able to implement sending of sms from my php site using smslive247 API. But now I want to be able to receive sms from phones to the same site. please someone should put me through.

You can use a "data stick" USB modem from your favourite (and cheapest) mobile network operator

In Linux you can use USB_ModeSwitch to switch the midem from data to modem mode and then it looks like a USB serial port

Simple code your own SMS commands to the modem and interpret the results OR use something like "SMS Server Tools 3" to send & receive. Note that any required scripts for SMS Server Tools 3 can be coded in PHP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.