发送事务性短信

v1.0.0 2022-07-26 00:41 UTC

This package is auto-updated.

Last update: 2024-09-26 21:08:42 UTC


README

https://www.contacta.mx 的文档

快速轻松开始!

问题需要事务性短信更多信息、成本及其他

安装

> composer require contactamx/sms

入门指南

<?php

    require('vendor/autoload.php');

    use Contactamx\Sms\Bulker;
    $bulker = new Bulker();
    $bulker->setToken(YOUR_TOKEN_PROVIDED_BY_CONTACTA);
    
    // For send sms transactional
    $result = $bulker->sendMessage(YOUR_PHONE,YOUR_MESSAGE);
    if ($result->success) {
        
        echo "The id of the message is " . $result->id .PHP_EOL;
        echo "The message sent on  " . $result->added_on .PHP_EOL;
        echo "Additional data " . print_r($result->country, true) .PHP_EOL;
    
        $get_log = $bulker->check($result->id);
        print_r($get_log);
    }
    else{
        echo "Houston, we have a troubles: " .PHP_EOL. print_r($result, true) ;
    }
    
    // For send flash transactional
    $result = $bulker->sendFlash(YOUR_PHONE,YOUR_MESSAGE);
    if ($result->success) {
        
        echo "The id of the message is " . $result->id .PHP_EOL;
        echo "The message sent on  " . $result->added_on .PHP_EOL;
        echo "Additional data " . print_r($result->country, true) .PHP_EOL;
    
        $get_log = $bulker->check($result->id);
        print_r($get_log);
    }
    else{
        echo "Houston, we have a troubles: " .PHP_EOL. print_r($result, true) ;
    }

    // For send otp message
    $result = $bulker->sendOtp(YOUR_PHONE,YOUR_MESSAGE);
    if ($result->success) {
        
        echo "The id of the message is " . $result->id .PHP_EOL;
        echo "The message sent on  " . $result->added_on .PHP_EOL;
        echo "Additional data " . print_r($result->country, true) .PHP_EOL;
    
        $get_log = $bulker->check($result->id);
        print_r($get_log);
    
        $verify_otp = $bulker->verifyOtp(YOUR_PHONE,YOUR_OTP_CODE);
        print_r($result);
    }
    else{
        echo "Houston, we have a troubles: " .PHP_EOL. print_r($result, true) ;
    }
    
?>