SIMPLE SMS API IN PHP
DIDForSale SMS API lets you handle incoming SMS in your application. You can configure the SMS to forward to your URL. Once you set the SMS to your web URL, all the incoming messages will be forwarded to your web URL. From there your application can do further routing or take actions depending on your further requirements and configurations.
How to configure the SMS to forward to web URL?
- Login your DIDForSale customer portal.
- Click on Manage Products
- SMS.
- Select the DID number you want to forward to your web URL.
Please note the DID number you choose should have SMS Enabled on it. - Choose DID action to “Update SMS Forwarding”
- Click on Apply
Below are the screenshots from DIDForSale customer portal to manage SMS Service.
Figure1. Manage SMS service on a phone number.
Once you Choose the DID number that you want to update SMS forwarding on and click Apply you will then be taken to Manage SMS Forwarding. Please See Figure 2. Manage SMS Forwarding.
On this screen you will update the URL. You can choose from one of the three available options.
- Forward SMS to phone number
- Forward SMS to email
- Select HTTP URL for SMS Forwarding to your API.
- Select the 3rd option Select HTTP URL for SMS Forwarding to your API.
Here you will type in the SMS API URL where you want to forward the SMS.
Screenshot of Manage SMS Forwarding screen from customer portal
Figure 2. Manage SMS Forwarding
All the future incoming SMS will be forwarded to this new SMS API URL you just configured. You might be using incoming SMS for update/order from customer or may be using SMS for Authentication purpose.
SMS API example!
Here in this simple SMS API example, we will forward the SMS to email address.
When we send the request to your SMS API URL we send following parameters in JSON FORMAT:-
- “From”,
- “To”
- “Text”
Syntax:
{“text”:”This is a text message to sms api”,”from”:”19499300360″,”to”:[“19495354600”]}
Here is PHP Code snippet.
1 2 3 4 5 6 7 8 9 10 |
<?php $response = json_decode(file_get_contents('php://input'), r); $subject="You Received a SMS"; $Message="Here is your message\n"; $Message.="From =". $response['from']."\n"; $Message.="To =". $response['to'][0]."\n"; $Message.="Message =". $response['text']."\n"; echo $Message ; mail("email@example","$subject",$Message) ?> |
This is just a simple example to demonstrate how the system works. Based on your needs you can build a system that meets your unique and comprehensive requirements. You can do anything you want with it. You can easily build a complicated SMS or Voice Application using our Developer Kit
New Posts
Benefits of Using Bulk SMS Service
Special Intro Offer FREE First MonthBenefits of Using Bulk SMS ServiceYou want to get the word out on your exciting new offers? How do you achieve that with certainty? You need an assurance that your customers would follow up with you. Working it up with a bulk SMS...
Why Are Businesses Switching to SIP?
Free SIPTrunks, Pay as You Go!
Pay As You GoSpecial Intro Offer FREE First MonthFree SIPTrunks, Pay as You Go!. No matter your existing PBX service, it is upgradable to receive voice calls over the internet or VoIP using a SIP trunk gateway. We provide compatibility with all leading PBX providers...

How to become a VoIP Reseller?
How can you be one?Start RESELLING With US Step by step guide to become a VoIP Reseller. With the recent shift in how businesses are carrying their day to day business, telecom has become an integral part of any organization. Traditional landline systems are not only...

What Is White Label VoIP? How does it work?
White label VoIP is a platform allows you to become your own VoIP provider. You Market, Quote, Sell & Invoice under your brand umbrella.

Is your business ready to work remotely?
Is your team ready to manage business operations remotely? We are fully equipped to provide uninterrupted support to our clients.

Understand the difference between MMS and SMS
Learn more about our Products
Visit SIP Trunking Pricing to see which plan suits your business!
Our plans have been packaged together to give you optimum output.