Click send is the api provider using this we can send the message to any mobile number with link its price is simple and low cost api thats why i mad the tool to send bulk sms


First install the clicksend PHP SDK through composer

composer.json

{
    "require": {
        "clicksend/clicksend-php": "^5.0"
    }
}


then open the command prompt in your root directory and execute the command 

C:\xampp\htdocs\clicksend>composer update



It will automatically generate the vendor folder and autoload.php inside vender directory 


clicksend/
┣ assets/
┃ ┣ logo.png
┃ ┣ main.js
┃ ┗ style.css
┣ nbproject/
┃ ┣ private/
┃ ┃ ┣ private.properties
┃ ┃ ┗ private.xml
┃ ┣ project.properties
┃ ┗ project.xml
┣ vendor/
┃ ┣ bin/
┃ ┣ clicksend/
┃ ┃ ┗ clicksend-php/
┃ ┃   ┣ docs/
┃ ┃ ┃ ┃ ┣ Api/
┃ ┃ ┃ ┃ ┗ Model/
┃ ┃   ┣ lib/
┃ ┃ ┃ ┃ ┣ Api/
┃ ┃ ┃ ┃ ┣ Model/
┃ ┃ ┃ ┃ ┣ ApiException.php
┃ ┃ ┃ ┃ ┣ Configuration.php
┃ ┃ ┃ ┃ ┣ HeaderSelector.php
┃ ┃ ┃ ┃ ┗ ObjectSerializer.php
┃ ┃   ┣ test/
┃ ┃ ┃ ┃ ┣ Api/
┃ ┃ ┃ ┃ ┗ Model/
┃ ┃   ┣ .php_cs
┃ ┃   ┣ .travis.yml
┃ ┃   ┣ composer.json
┃ ┃   ┣ phpunit.xml.dist
┃ ┃   ┗ README.md
┃ ┣ composer/
┃ ┃ ┣ autoload_classmap.php
┃ ┃ ┣ autoload_files.php
┃ ┃ ┣ autoload_namespaces.php
┃ ┃ ┣ autoload_psr4.php
┃ ┃ ┣ autoload_real.php
┃ ┃ ┣ autoload_static.php
┃ ┃ ┣ ClassLoader.php
┃ ┃ ┣ installed.json
┃ ┃ ┣ installed.php
┃ ┃ ┣ InstalledVersions.php
┃ ┃ ┣ LICENSE
┃ ┃ ┗ platform_check.php
┃ ┣ guzzlehttp/
┃ ┃ ┣ guzzle/
┃ ┃ ┃ ┣ src/
┃ ┃ ┃ ┃ ┣ Cookie/
┃ ┃ ┃ ┃ ┣ Exception/
┃ ┃ ┃ ┃ ┣ Handler/
┃ ┃ ┃ ┃ ┣ BodySummarizer.php
┃ ┃ ┃ ┃ ┣ BodySummarizerInterface.php
┃ ┃ ┃ ┃ ┣ Client.php
┃ ┃ ┃ ┃ ┣ ClientInterface.php
┃ ┃ ┃ ┃ ┣ ClientTrait.php
┃ ┃ ┃ ┃ ┣ functions.php
┃ ┃ ┃ ┃ ┣ functions_include.php
┃ ┃ ┃ ┃ ┣ HandlerStack.php
┃ ┃ ┃ ┃ ┣ MessageFormatter.php
┃ ┃ ┃ ┃ ┣ MessageFormatterInterface.php
┃ ┃ ┃ ┃ ┣ Middleware.php
┃ ┃ ┃ ┃ ┣ Pool.php
┃ ┃ ┃ ┃ ┣ PrepareBodyMiddleware.php
┃ ┃ ┃ ┃ ┣ RedirectMiddleware.php
┃ ┃ ┃ ┃ ┣ RequestOptions.php
┃ ┃ ┃ ┃ ┣ RetryMiddleware.php
┃ ┃ ┃ ┃ ┣ TransferStats.php
┃ ┃ ┃ ┃ ┗ Utils.php
┃ ┃ ┃ ┣ vendor-bin/
┃ ┃ ┃ ┃ ┣ php-cs-fixer/
┃ ┃ ┃ ┃ ┣ phpstan/
┃ ┃ ┃ ┃ ┗ psalm/
┃ ┃ ┃ ┣ CHANGELOG.md
┃ ┃ ┃ ┣ composer.json
┃ ┃ ┃ ┣ LICENSE
┃ ┃ ┃ ┣ README.md
┃ ┃ ┃ ┗ UPGRADING.md
┃ ┃ ┣ promises/
┃ ┃ ┃ ┣ src/
┃ ┃ ┃ ┃ ┣ AggregateException.php
┃ ┃ ┃ ┃ ┣ CancellationException.php
┃ ┃ ┃ ┃ ┣ Coroutine.php
┃ ┃ ┃ ┃ ┣ Create.php
┃ ┃ ┃ ┃ ┣ Each.php
┃ ┃ ┃ ┃ ┣ EachPromise.php
┃ ┃ ┃ ┃ ┣ FulfilledPromise.php
┃ ┃ ┃ ┃ ┣ functions.php
┃ ┃ ┃ ┃ ┣ functions_include.php
┃ ┃ ┃ ┃ ┣ Is.php
┃ ┃ ┃ ┃ ┣ Promise.php
┃ ┃ ┃ ┃ ┣ PromiseInterface.php
┃ ┃ ┃ ┃ ┣ PromisorInterface.php
┃ ┃ ┃ ┃ ┣ RejectedPromise.php
┃ ┃ ┃ ┃ ┣ RejectionException.php
┃ ┃ ┃ ┃ ┣ TaskQueue.php
┃ ┃ ┃ ┃ ┣ TaskQueueInterface.php
┃ ┃ ┃ ┃ ┗ Utils.php
┃ ┃ ┃ ┣ CHANGELOG.md
┃ ┃ ┃ ┣ composer.json
┃ ┃ ┃ ┣ LICENSE
┃ ┃ ┃ ┣ Makefile
┃ ┃ ┃ ┗ README.md
┃ ┃ ┗ psr7/
┃ ┃   ┣ src/
┃ ┃ ┃ ┃ ┣ Exception/
┃ ┃ ┃ ┃ ┣ AppendStream.php
┃ ┃ ┃ ┃ ┣ BufferStream.php
┃ ┃ ┃ ┃ ┣ CachingStream.php
┃ ┃ ┃ ┃ ┣ DroppingStream.php
┃ ┃ ┃ ┃ ┣ FnStream.php
┃ ┃ ┃ ┃ ┣ Header.php
┃ ┃ ┃ ┃ ┣ HttpFactory.php
┃ ┃ ┃ ┃ ┣ InflateStream.php
┃ ┃ ┃ ┃ ┣ LazyOpenStream.php
┃ ┃ ┃ ┃ ┣ LimitStream.php
┃ ┃ ┃ ┃ ┣ Message.php
┃ ┃ ┃ ┃ ┣ MessageTrait.php
┃ ┃ ┃ ┃ ┣ MimeType.php
┃ ┃ ┃ ┃ ┣ MultipartStream.php
┃ ┃ ┃ ┃ ┣ NoSeekStream.php
┃ ┃ ┃ ┃ ┣ PumpStream.php
┃ ┃ ┃ ┃ ┣ Query.php
┃ ┃ ┃ ┃ ┣ Request.php
┃ ┃ ┃ ┃ ┣ Response.php
┃ ┃ ┃ ┃ ┣ Rfc7230.php
┃ ┃ ┃ ┃ ┣ ServerRequest.php
┃ ┃ ┃ ┃ ┣ Stream.php
┃ ┃ ┃ ┃ ┣ StreamDecoratorTrait.php
┃ ┃ ┃ ┃ ┣ StreamWrapper.php
┃ ┃ ┃ ┃ ┣ UploadedFile.php
┃ ┃ ┃ ┃ ┣ Uri.php
┃ ┃ ┃ ┃ ┣ UriNormalizer.php
┃ ┃ ┃ ┃ ┣ UriResolver.php
┃ ┃ ┃ ┃ ┗ Utils.php
┃ ┃   ┣ vendor-bin/
┃ ┃ ┃ ┃ ┣ php-cs-fixer/
┃ ┃ ┃ ┃ ┣ phpstan/
┃ ┃ ┃ ┃ ┗ psalm/
┃ ┃   ┣ CHANGELOG.md
┃ ┃   ┣ composer.json
┃ ┃   ┣ LICENSE
┃ ┃   ┗ README.md
┃ ┣ psr/
┃ ┃ ┣ http-client/
┃ ┃ ┃ ┣ src/
┃ ┃ ┃ ┃ ┣ ClientExceptionInterface.php
┃ ┃ ┃ ┃ ┣ ClientInterface.php
┃ ┃ ┃ ┃ ┣ NetworkExceptionInterface.php
┃ ┃ ┃ ┃ ┗ RequestExceptionInterface.php
┃ ┃ ┃ ┣ CHANGELOG.md
┃ ┃ ┃ ┣ composer.json
┃ ┃ ┃ ┣ LICENSE
┃ ┃ ┃ ┗ README.md
┃ ┃ ┣ http-factory/
┃ ┃ ┃ ┣ src/
┃ ┃ ┃ ┃ ┣ RequestFactoryInterface.php
┃ ┃ ┃ ┃ ┣ ResponseFactoryInterface.php
┃ ┃ ┃ ┃ ┣ ServerRequestFactoryInterface.php
┃ ┃ ┃ ┃ ┣ StreamFactoryInterface.php
┃ ┃ ┃ ┃ ┣ UploadedFileFactoryInterface.php
┃ ┃ ┃ ┃ ┗ UriFactoryInterface.php
┃ ┃ ┃ ┣ .gitignore
┃ ┃ ┃ ┣ .pullapprove.yml
┃ ┃ ┃ ┣ composer.json
┃ ┃ ┃ ┣ LICENSE
┃ ┃ ┃ ┗ README.md
┃ ┃ ┗ http-message/
┃ ┃   ┣ src/
┃ ┃ ┃ ┃ ┣ MessageInterface.php
┃ ┃ ┃ ┃ ┣ RequestInterface.php
┃ ┃ ┃ ┃ ┣ ResponseInterface.php
┃ ┃ ┃ ┃ ┣ ServerRequestInterface.php
┃ ┃ ┃ ┃ ┣ StreamInterface.php
┃ ┃ ┃ ┃ ┣ UploadedFileInterface.php
┃ ┃ ┃ ┃ ┗ UriInterface.php
┃ ┃   ┣ CHANGELOG.md
┃ ┃   ┣ composer.json
┃ ┃   ┣ LICENSE
┃ ┃   ┗ README.md
┃ ┣ ralouphie/
┃ ┃ ┗ getallheaders/
┃ ┃   ┣ src/
┃ ┃ ┃ ┃ ┗ getallheaders.php
┃ ┃   ┣ composer.json
┃ ┃   ┣ LICENSE
┃ ┃   ┗ README.md
┃ ┣ symfony/
┃ ┃ ┗ deprecation-contracts/
┃ ┃   ┣ .gitignore
┃ ┃   ┣ CHANGELOG.md
┃ ┃   ┣ composer.json
┃ ┃   ┣ function.php
┃ ┃   ┣ LICENSE
┃ ┃   ┗ README.md
┃ ┗ autoload.php
┣ cacert.pem
┣ composer.json
┣ composer.lock
┣ index.php
┣ multiple_number.php
┗ readme


We have to consantrate on few file look at the instruction below


index.php

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title> 
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
        <style>
            body{
                background: #f1f3f0;

            }
            body .col-md-10{
                border: 1px solid #6d6d6d;
                padding: 20px;
                margin-top: 10%;
            }

            .form-control{
                background: #d4cdcd;
                border: 1px solid #6d6d6d!important;
            }

            #submit-btn{
                background: #283944;
                border: none;
            }
            #responce{
                color: #3ca6ff;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="col"></div>
                <div class="col-md-10">

                    <img src="assets/logo.png" alt="" style="width: 50%">

                    <div id="responce"></div>
                    <form action="" method="post" enctype="multipart/form-data">

                        <div class="row mb-3">
                            <div class="col">
                                <textarea placeholder="Number List" id="numbers" class="form-control" rows="5"></textarea>
                            </div>

                            <div class="col">
                                <textarea placeholder="Message" id="message"  class="form-control" rows="5"></textarea>
                            </div>
                        </div>

                   
                        <div class="row mb-3">
                            <div class="d-grid gap-2">
                                <input class="btn btn-primary btn-lg" type="button" id="submit-btn" value="Send Now" onclick="start_sendig();">
                            </div>
                        </div>  
                    </form>

                    <footer class="text-center">Alright reserved by the rathorji</footer>
                </div>
                <div class="col"></div>
            </div>
        </div>
        <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
        <script src="assets/main.js" type="text/javascript"></script>
    </body>
</html>


multiple_number.php

<?php

require_once(__DIR__ . '/vendor/autoload.php');

// Configure HTTP basic authorization: BasicAuth
$config = ClickSend\Configuration::getDefaultConfiguration()
        ->setUsername('support@rathorji.in')
        ->setPassword('8A5C925B-2826-9526-2151-69B54F7CC651');

$apiInstance = new ClickSend\Api\SMSApi(new GuzzleHttp\Client(), $config);
$msg = new \ClickSend\Model\SmsMessage();


if (isset($_POST['numbers'])) {
    $numbers = $_POST['numbers'];
    $message = $_POST['message'];
    foreach (explode("+", $numbers) as $phone) {

        $msg->setBody($message);
        $msg->setTo($phone);
        $msg->setSource("sdk");
        $sms_messages = new \ClickSend\Model\SmsMessageCollection();
        $sms_messages->setMessages([$msg]);

        try {
            $result = $apiInstance->smsSendPost($sms_messages);
            $arr_result = json_decode($result, TRUE);

            if ($arr_result['response_code'] == "SUCCESS") {
                $data = array(
                    "response" => "success",
                    "current" => '+' . $phone
                );

                echo json_encode($data);
            }
        } catch (Exception $e) {
            echo 'Exception when calling SMSApi->smsSendPost: ', $e->getMessage(), PHP_EOL;
        }
    }
} else {
    echo "Please add your number list and message!";
}


Here we had added the autoload.php file and create the object of clicksend to call the functions of class clicksend to add the numbers and text message to send SMS look at the code above


then you have to create the assets folder and create the main.js file where we will use the ajax to send the request to php for the perticular mobile number see the code below


assets/manin.js

function start_sendig() {
    $('#responce').html("Please wait sending...");
    //var numbers = $('#numbers').val().replace(/(?:\r\n|\r|\n)/g, ',');
    var numbers = $('#numbers').val();
    var message = $('#message').val();
    var path_uri = "multiple_number.php";
    var number = numbers.split('+');

    $.ajax({
        type: "POST",
        url: path_uri,
        data: {
            numbers: number_loop(number),
            message: message
        },
        success: function(data) {
            console.log(data);
            var json = $.parseJSON(data);
            if (json.response == "success") {
                $('#responce').html("Messages Sent Successfully");
            } else {
                $('#responce').html("Error to Sent message!");
            }


        }

    });
}

var i = 0;
function number_loop(numbers) {
    var number = numbers[i];
    $("#curent-number").html("Please wait we are sending...");
    if (++i < numbers.length) {
        setTimeout(start_sendig, 1000);
    }
    return number;
}


$('#message').keydown(function(e) {

    var path_uri = "encryption.php";
    $.ajax({
        type: "POST",
        url: path_uri,
        data: {
            textmessage: $(this).val()

        },
        success: function(data) {
            $('#encymessage').val(data);

        }
    });

});

Thanks you will find something amazing here and if you have any problem you can download the code below zip file where you don't need to do anything just add your api key and run on your server its simple way to send the bulk sms using click send api


Thanks.......




Download source code

Are you facing problems in understanding this article? download source code now