Flowroute SMS API using yii 1

In this post we will show you “Flowroute SMS API using yii 1, hear for Flowroute SMS API using yii 1 we will give you demo and example for implement.

Read More and developer Dock

NOTE : after download git package random “src” to “FlowrouteMessagingLib”

Flowroute SMS API using yii 1 Code

#Import Message controller and model
use FlowrouteMessagingLib\Controllers\MessagesController;
use FlowrouteMessagingLib\Models\Message;

/* Demo script*/

#Instantiate the Controller and pass your API credentials

// add your API_ACCESS_KEY and API_SECRET_KEY hear

$controller = new MessagesController('API_ACCESS_KEY','API_SECRET_KEY');

#Create and Send a message
$from_number = 'FROM_PHONE_NUMBER';
//$from_number = '18444598700';

$to_number = 'TO_PHONE_NUMBER';
$to_number = '12062092844';

$message = new Message($to_number, $from_number, 'Message content');
//$message = new Message('18444205700', '12062092844', 'Get some exercise!');

#Print the response
$message_response = $controller->createMessage($message);

#Get  the MDR ID from the response
$get_mdr_id =  strval($message_response->data->id);

#Retrieve the MDR record
try {
    $mdr_record_val = $controller->getMessageLookup($get_mdr_id); 
	// 'mdr1-b334f89df8de4f8fa7ce377e06090a2e'
} catch(\FlowrouteMessagingLib\APIException $excpt) 
    print("Error - " . strval($excpt->getResponseCode()) . ' ' . $excpt->getMessage());

Response for Flowroute SMS API using yii 1

Example Response

[npas] => stdClass Object
    [201] => stdClass Object
            [nxxs] => /v1/available-tns/npanxxs/?npa=201
            [tns] => /v1/available-tns/tns/?npa=201

    [203] => stdClass Object
            [nxxs] => /v1/available-tns/npanxxs/?npa=203
            [tns] => /v1/available-tns/tns/?npa=203

    [202] => stdClass Object
            [nxxs] => /v1/available-tns/npanxxs/?npa=202
            [tns] => /v1/available-tns/tns/?npa=202


[links] => stdClass Object
    [next] => /v1/available-tns/npas/?limit=3&page=2

Hope this code and post will helped you for implement Flowroute SMS API using yii 1. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org