1. Go to this page and download the library: Download talkylabs/reach-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
talkylabs / reach-sdk example snippets
// Send an SMS using Reach's REST API and PHP
// Required if your environment does not handle autoloading
new Reach\Rest\Client($apiUser, $apiKey);
// Use the Client to make requests to the Reach REST API
$client->messaging->messagingItems->send(
'+15558675309', '+15017250604', "Hey Jenny! Good luck on the bar exam!"
);
// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
\Client($apiUser, $apiKey);
// Use the Client to make requests to the Reach REST API
$client->messaging->messagingItems->send(
// The number you'd like to send the message to
'+15558675309', '+15017250604', "Hey Jenny! Good luck on the bar exam!"
);
User = "XXXXXXXX";
$apiKey = "YYYYYY";
$client = new Reach\Rest\Client($apiUser, $apiKey);
// Get an object using its SID. If you do not have a SID,
// check out the list resource examples on this page
$msg = $client->messaging->messagingItems()->fetch("XXed11f93dc08b952027ffbc406d0868");
print $msg->dest;
User = "XXXXXXXX";
$apiKey = "YYYYYY";
$client = new Reach\Rest\Client($apiUser, $apiKey);
// Loop over the list of messagingItems and print a property from each one
foreach ($client->messaging->messagingItems->read() as $msg) {
print $msg->dest;
}
Reach\Exceptions\ConfigurationException;
use Reach\Rest\Client;
$apiUser = "XXXXXXXX";
$apiKey = "YYYYYY";
// Attempt to create a new Client, but your credentials may contain a typo
try {
$client = new Reach\Rest\Client($apiUser, $apiKey);
} catch (ConfigurationException $e) {
// You can `catch` the exception, and perform any recovery method of your choice
print $e . getCode();
}
$msg = $client->messaging->messagingItems()->
->fetch("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
print $msg->dest;