You are currently viewing How do I Integrate an SMS API in PHP?
How do I integrate an SMS API in PHP

How do I Integrate an SMS API in PHP?

  • Post author:
  • Post category:News
  • Post comments:0 Comments

SMS API is one of the important strings to be pasted on any application or software. Its importance is only because verification is an important part of any data security, everyone wants to be protected his data. Bulk SMS API plays an important role to secure your login with the mobile number identification through the OTP verification, it is called a two factor authentication. API stands for Application Program Interface, this is a bridge between SMS Application and Software. Any application or software developed in PHP code needs to paste SMS API string where you want to trigger the link.

Every PHP software can be integrated with the Bulk SMS API, so that customers can receive details and desired information according to the requirement. So the SMS API integration on every PHP Software is now important for the user of this software, so that they can send information to their customers which user want to send. Integration of SMS API is very easy in PHP code software because of the API documents are provided by Bulk SMS API service provider.

Below details given are sample PHP code for Send SMS. Given parameters need to be put on application from where the data needs to pick. Here is also an Example Response code from where you can check the response. You can also integrate some optional parameters if required like, unicode, time, flash and format as per the requirement. There are some information and guidance for the integration of the bulk SMS API in PHP code.

Sample Code for Send SMS in PHP :

‘–  Use URLEncode for parameter msgtext
<?php
$apikey=”xxxxx”;
$sender=”xxxxx”;
$mobile=”xxxxx”;
$msg=urlencode(“xxxxx”);
$url = “https://bulksmsindia.app/V2/http-api.php?apikey=$apikey&senderid=$sender&number=$mobile&message=$msg“;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);
echo $curl_scraped_page;
?>

Note : Some Option Parameters are unicode(Unicode), time(Schedule time), flash(Flash), format(php/json) etc.

Example Responses in PHP :

Array
(
    [status] => OK
    [data] => Array
        (
            [0] => Array
                (
                    [id] => 34-1
                    [mobile] => 91XXXXXXXXXX
                    [status] => SUBMITTED
                )

            [1] => Array
                (
                    [id] => 34-2
                    [mobile] => 91XXXXXXXXXX
                    [status] => SUBMITTED
                )

            [2] => Array
                (
                    [id] => 34-3
                    [mobile] => 91XXXXXXXXXX
                    [status] => SUBMITTED
                )

        )
    [msgid] => 91XXXXXXXXXX
    [message] => message Submitted successfully
)

Response Data :

status : It indicates the success or failure of your request.
message : It indicates the success or failure message.
data : All the response is wrapped in side data
mobile : Mobile number the sms will be sent
status : Status of the message
msgid : Message id of the sent message

Call : +91 9868891277
Write : care@www.osdigital.in

More : http://www.osdigital.in/


Leave a Reply