Skip to content

Instantly share code, notes, and snippets.

@grokify
Created August 15, 2016 05:07
Show Gist options
  • Save grokify/18b7c362b08a1fa3720fff53aa62f31b to your computer and use it in GitHub Desktop.
Save grokify/18b7c362b08a1fa3720fff53aa62f31b to your computer and use it in GitHub Desktop.
RC Blog 2015-02 Launch Hackathon
<?php
require('vendor/autoload.php');
use RC\core\cache\MemoryCache;
use RC\core\ajax\Request;
use RC\RCSDK;
#Initialize the SDK and authenticate
$rcsdk = new RCSDK(
new MemoryCache(),
'4XpQOskjdfhhYTkeIuQ',
'oZr3F5XcRresjiv2abcdefhgpfbTbmh77e36mgdtA',
'https://platform.devtest.ringcentral.com'
);
$rcsdk->getPlatform()->authorize(16501111111', '', 'xxxxxxx', true);
#Invoke getExtension API to retrieve extension information
$ajax = $rcsdk->getPlatform()->apiCall(new Request('GET', '/account/~/extension/~'));
print_r($ajax->getResponse()->getData(). "\n");
#Send an SMS to a mobile number
$ajax = $rcsdk->getPlatform()->apiCall(new Request('POST', '/account/~/extension/~/sms', null, [
'from' => ['phoneNumber' => '16501111111'],
'to' => [
['phoneNumber' => '16501111111']
],
'text' => 'Test from PHP',
]));
print_r($ajax->getResponse()->getData());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment