Comments (12)
You have to add
use RC\subscription\Subscription;
statement or refer to the full name of class: RC\subscription\Subscription
.
from ringcentral-php.
Should it not be included in the autoloader?
from ringcentral-php.
Autoloader only tells php where to locate files, so it's already covered by Autoloader.
In the rest of your code you use full class names and it works, so do the same for subscription. Or have one use statement at the top of your file.
from ringcentral-php.
Okay thank you very much. I was confused about autoloading but you cleared it up.
from ringcentral-php.
No problem :)
from ringcentral-php.
Receiving this error. I don't want to change protected to public without your advice.
Stack Trace
PHP Fatal error: Call to protected method RC\subscription\Subscription::notify() from context 'Pubnub\Pubnub' in /home/rafael/PhpstormProjects/ringcentral-vm/vendor/pubnub/pubnub/composer/lib/Pubnub/Pubnub.php on line 468
PHP Stack trace:
PHP 1. {main}() /home/rafael/PhpstormProjects/ringcentral-vm/program.php:0
PHP 2. VMDownloader->startListener() /home/rafael/PhpstormProjects/ringcentral-vm/program.php:62
PHP 3. RC\subscription\Subscription->register($options = *uninitialized*) /home/rafael/PhpstormProjects/ringcentral-vm/program.php:44
PHP 4. RC\subscription\Subscription->subscribe($options = *uninitialized*) /home/rafael/PhpstormProjects/ringcentral-vm/vendor/ringcentral/php-sdk/lib/RC/subscription/Subscription.php:76
PHP 5. RC\subscription\Subscription->subscribeAtPubnub() /home/rafael/PhpstormProjects/ringcentral-vm/vendor/ringcentral/php-sdk/lib/RC/subscription/Subscription.php:119
PHP 6. Pubnub\Pubnub->subscribe($channel = *uninitialized*, $callback = *uninitialized*, $timeToken = *uninitialized*, $presence = *uninitialized*) /home/rafael/PhpstormProjects/ringcentral-vm/vendor/ringcentral/php-sdk/lib/RC/subscription/Subscription.php:241
PHP 7. Pubnub\Pubnub->_subscribe($channel = *uninitialized*, $channelGroup = *uninitialized*, $callback = *uninitialized*, $timeToken = *uninitialized*, $presence = *uninitialized*) /home/rafael/PhpstormProjects/ringcentral-vm/vendor/pubnub/pubnub/composer/lib/Pubnub/Pubnub.php:365
Program.php
<?php
require_once('vendor/autoload.php');
use \RC\SDK;
use \RC\subscription\events\NotificationEvent;
use \RC\subscription\Subscription;
class VMDownloader
{
// Configuration
const KEY = 'my_app_key';
const SECRET = 'my_app_secret';
const SERVER = 'https://platform.devtest.ringcentral.com';
const MAIN_NUMBER = 'my_username';
const PASSWORD = 'my_password';
private $sdk;
function __construct()
{
$this->sdk = new SDK(self::KEY, self::SECRET, self::SERVER);
$this->sdk->getPlatform()->authorize(self::MAIN_NUMBER, '', self::PASSWORD, true);
}
public function getVoicemails()
{
return $this->sdk->getPlatform()
->get('/account/~/extension/~/message-store', ['messageType' => 'VoiceMail'])
->getJson();
}
/**
* Listens for new messages
*/
public function startListener()
{
$this->sdk->getSubscription()
->addEvents(['/restapi/v1.0/account/~/extension/~/message-store'])
->on(Subscription::EVENT_NOTIFICATION, function (NotificationEvent $e) {
print_r($e->getPayload());
// TODO: Add curl downloader
})
->register();
}
/**
* @todo finish function definition
*/
private function download()
{
}
function __destructor()
{
print 'Destroyed';
}
}
$t = new VMDownloader();
$t->startListener();
from ringcentral-php.
What version of PHP do you have?
from ringcentral-php.
rafael@rcepeda:~/Downloads/PhpStorm-141.1912/bin$ php -v
PHP 5.6.4-4ubuntu6.2 (cli) (built: Jul 2 2015 15:29:28)
from ringcentral-php.
I've pushed a small fix for your case, go ahead and try. The fix is in DEVELOP branch.
from ringcentral-php.
Thank you sir.
On Jul 17, 2015 3:28 PM, "Kirill Konshin" [email protected] wrote:
I've pushed a small fix for your case, go ahead and try. The fix is in
DEVELOP branch.—
Reply to this email directly or view it on GitHub
#2 (comment).
from ringcentral-php.
@ralph3991: I replaced the app and user credentials with placeholders in your posts. For security purposes, please don't post your app and user credentials online.
from ringcentral-php.
okay, since it was a sandbox, I did not mind it. But I gotcha
from ringcentral-php.
Related Issues (20)
- PHPOption deprecation warning
- 400 Bad Request (and additional error happened during JSON parse: Response is not JSON)
- FatalError: Unparenthesized `a ? b : c ? d : e` is not supported HOT 2
- php 7.4 Ternary Operator Issue HOT 1
- Undefined array key "code_challenge" HOT 1
- Issue with PHP version 7.4
- telephony webhook end
- Do not specify default "Accept" header HOT 1
- Upgrade PubNub dependency HOT 4
- Root package 'ringcentral/ringcentral-php' cannot require itself in its composer.json
- Required changes for Global Authentication Changes? :question:
- Symfony 7 dependency HOT 1
- Error message truncated in SDK HOT 5
- Unable to pass body in delete request HOT 1
- Symfony/event-dispatcher 5.1.0 not compatible HOT 1
- Whitesource CVE-2020-28032
- Face issue while sending the mms with image.
- trying to filter extension list results in an error with urlencode()
- Client error: `POST https://platform.devtest.ringcentral.com/restapi/oauth/token` resulted in a 400 Bad Request HOT 1
- Composer error: incompatible with guzzlehttp/psr7 2.x+ HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ringcentral-php.