2016-07-20 1 views
0

J'ai créé une Server-only (No UI) application privée, avec l'autorisation de lecture du journal des appels, et lorsque la connexion est émise je reçois l'erreur suivante:RingCentral API Connexion retourne la chaîne de réponse non valide

Exception: Invalid response string SDK HTTP Error at https:///platform.devtest.ringcentral.com/restapi/oauth/token Response text: Previous: Invalid response string #0 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(214): RingCentral\SDK\Http\Client->send(Object(RingCentral\Psr7\Request)) \#1 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(301): RingCentral\SDK\Platform\Platform->sendRequest(Object(RingCentral\Psr7\Request), Array) #2 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(123): RingCentral\SDK\Platform\Platform->requestToken('/restapi/oauth/...', Array) #3 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/demo/callRecording.php(25): RingCentral\SDK\Platform\Platform->login('+15188315198', 101, 'xxxxxxxxxxxx', true) #4 {main}

Qu'est-ce que je manque? Pourquoi ai-je cette erreur? Voici le code:

require_once('_bootstrap.php'); 

use RingCentral\SDK\SDK; 

// Create SDK instance 

$credentials = array(
    'username'  => '+15188315198',  // your RingCentral account phone number 
    'extension' => 101,    // or number 
    'password'  => 'xxxxxxxxxxxx', 
    'appKey'  => 'xxxxxxxxxxxxxxx', 
    'appSecret' => 'xxxxxxxxxxx', 
    'server'  => 'https:platform.devtest.ringcentral.com', 
    'dateFrom' => '1/1/2016' 
); 

$rcsdk = new SDK($credentials['appKey'], $credentials['appSecret'], $credentials['server'], 'Demo', '1.0.0'); 

$platform = $rcsdk->platform(); 

$platform->login($credentials['username'], $credentials['extension'], $credentials['password'], true); 

Répondre

0

Pouvez-vous confirmer, si vous avez installé notre SDK PHP en utilisant Composer?

Si vous avez, pourriez-vous confirmer si les étapes ci-dessous sont suivies:

1.) Installation RingCentral SDK PHP en utilisant Composer

https://github.com/ringcentral/ringcentral-php#with-composer-recommended 

2.) Vous auriez besoin d'exiger la AutoLoader du compositeur dans votre script PHP.

require_once(__DIR__ . '/vendor/autoload.php'); 

permet de dire que la structure du dossier ressemble à ceci comme ci-dessous:

your application (application name)
-vendor (PHP SDK whihc is installed using Composer)
-index.php (application's PHP Script)

comprennent Veuillez le "AutoLoader" dans le script index.php dans votre application.

est ci-dessous comment l'exemple de code ressemblerait à ceci:

<?php 

require_once(__DIR__ . '/vendor/autoload.php'); 

use RingCentral\SDK\SDK; 

// Create SDK instance 
$rcsdk = new SDK("appKey", "appSecret" , "https://platform.devetst.ringcentral.com", 'Demo', '1.0.0'); 

// Create Platform Singleton Instance 
$platform = $rcsdk->platform(); 

// Login 
$auth = $platform->login("Username", "extension", "password"); 

// Respsone 
print 'Login Success' . $auth->text() . PHP_EOL; 
0
  1. Oui je l'ai installé RingCentral SDK PHP en utilisant
  2. Composer
  3. J'ai remplacé le require_once ('_ bootstrap.php'); avec require_once ("vendor/autoload.php"); bien que c'est ce que les démos utilisent et je reçois toujours l'erreur.
  4. J'ai essayé l'exemple simple de connexion que vous avez inclus et je reçois la même erreur

Erreur fatale: Uncaught exception « InvalidArgumentException » message « chaîne de réponse non valide » dans /srv/www/vhosts/internal.kingscredit. com/includes/ringcentral-php-maître/fournisseur/ringcentral/psr7/src/functions.php: 478 Stack trace: # 0 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor /ringcentral/ringcentral-php/src/Http/ApiResponse.php(56): RingCentral \ Psr7 \ parse_response ('HTTP/1.1 0 OK \ r \ n') # 1 /srv/www/vhosts/internal.kingscredit.com /includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/Http/Client.php(99): RingCentral \ SDK \ Http \ ApiResponse -> __ construct (Objet (RingCentral \ Psr7 \ Request), faux, 0) # 2/srv/www/vhost s/internal.kingscredit.com/inclut/ringcentral-php-maître/fournisseur/ringcentral/ringcentral-php/src/Http/Client.php (25): RingCentral \ SDK \ Http \ Client-> loadResponse (Objet (RingCentral \ Psr7 \ Request)) # 3 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/Platform/Platform.php(214): RingCentral \ SDK \ Http \ Client-> dans /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/Http/Client.php à la ligne 44

0

J'ai ajouté le curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false); sur la ligne 73 de client.php et cela n'a fait aucune différence.

Erreur fatale: Uncaught exception 'de InvalidArgumentException' message 'chaîne de réponse non valide' dans /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/psr7/src/functions .php: 478 Trace de pile: # 0 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/Http/ApiResponse.php(56): RingCentral \ Psr7 \ parse_response ('HTTP/1.1 0 OK \ r \ n') # 1 /srv/www/vhosts/internal.kingscredit.com/includes/ringcentral-php-master/vendor/ringcentral/ringcentral-php/src/ Http/Client.php (99): RingCentral \ SDK \ Http \ ApiResponse -> __ construct (Objet (RingCentral \ Psr7 \ Request), false, 0) # 2 /srv/www/vhosts/internal.kingscredit.com/includes/ ringcentral-php-maître/fournisseur/ringcentral/ringcentral-php/src/Http/Client.php (25): RingCentral \ SDK \ Http \ Client-> loadResponse (Objet (RingCentral \ Psr7 \ Request)) # 3/srv/www/v hosts/internal.kingscredit.com/inclut/ringcentral-php-maître/vendeur/ringcentral/ringcentral-php/src/Plate-forme/Platform.php (214): RingCentral \ SDK \ Http \ Client-> dans/srv/www/vhosts/internal.kingscredit.com/inclut/ringcentral-php-maître/fournisseur/ringcentral/ringcentral-php/src/Http/Client.php à la ligne 44