Created
May 4, 2018 09:15
-
-
Save tsudot/c58f07b5b87a9dd651e9cdb2329efd3e to your computer and use it in GitHub Desktop.
Send SMS using Karix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(__DIR__ . '/vendor/autoload.php'); | |
// Configure HTTP basic authorization: basicAuth | |
$config = new \Swagger\Client\Configuration(); | |
$config->setUsername('AUTH_ID'); | |
$config->setPassword('AUTH_TOKEN'); | |
$apiInstance = new Swagger\Client\Api\MessageApi( | |
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. | |
// This is optional, `GuzzleHttp\Client` will be used as default. | |
new GuzzleHttp\Client(), | |
$config | |
); | |
$api_version = "1.0"; // string | API Version. If not specified your pinned verison is used. | |
$message = new \Swagger\Client\Model\CreateMessage(); // \Swagger\Client\Model\CreateAccount | Subaccount object | |
date_default_timezone_set('UTC'); | |
$message->setDestination(["+1XXX8323XXX", "+1XXX3234XXX"]); | |
$message->setSource("+1XXX2321XXX"); | |
$message->setText("Hello Friend"); | |
try { | |
$result = $apiInstance->sendMessage($api_version, $message); | |
print_r($result); | |
} catch (Exception $e) { | |
echo 'Exception when calling MessageApi->createMessage: ', $e->getMessage(), PHP_EOL; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment