Question

Fatal error: Call to undefined method

  • 21 March 2016
  • 6 replies
  • 1046 views

Hi, I'm having a little dive into the PHP SDK and having followed the guidance on GitHub I'm getting...


"Fatal error: Call to undefined method RingCentralSDKSDK::getPlatform()"


When using: $sdk->getPlatform()->login('USERNAME', 'EXT', 'PASS');


If I use: $sdk->platform()->login('USERNAME', 'EXT', 'PASS');


I get "curl_close(): 52 is not a valid cURL handle resource in phar:"

Any ideas why I can't even validate and login?


Thanks


James




6 replies

Has your PHP installation been compiled with cURL support?
Yes cURL is working fine, even testing with the following script.


<?php

// Script to test if the CURL extension is installed on this server

// Define function to test
function _is_curl_installed() {
    if  (in_array  ('curl', get_loaded_extensions())) {
        return true;
    }
    else {
        return false;
    }
}

// Ouput text to user based on test
if (_is_curl_installed()) {
  echo "cURL is <span style="color:blue">installed</span> on this server";
} else {
  echo "cURL is NOT <span style="color:red">installed</span> on this server";
}
?>
Gives the following "cURL is installed on this server".

Thanks 

James 



Which version of cURL and PHP are you using please?
Hi James,

To authenticate the user you should be using :
$sdk->platform()->login('USERNAME', 'EXT', 'PASS');
Do you have composer installed ? If so, have you provided the appropriate path for the composer's autoloader.

For a simpler understanding, take a look at the "develop" branch on our official PHP-SDK repository on github titled "How to Demo" once you have installed the SDK using either composer/PHAR:
https://github.com/ringcentral/ringcentral-php/tree/develop#how-to-demo
Hi PHP version is 5.5.9 cURL is 7.30.0...

I've now got it working, it seems to be a problem with the test server having a self signed certificate, I was using $sdk->getPlatform()->login('USERNAME', 'EXT', 'PASS'); as its what was originally detailed on the github page... 

Thanks 

James 
Yes, I too have had issues with self-signed certificates. If you just need a quick place to test that is not on your local machine, you can use Heroku (they support PHP) since the URL they provide you has a valid certificate chain available. Azure and GCP may also provide this feature, but I've not tested in those environments.

Reply