question

jamesodonnell90 avatar image
jamesodonnell90 asked Byrne Reese commented

Fatal error: Call to undefined method

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 RingCentral\SDK\SDK::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



sdk
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered
Has your PHP installation been compiled with cURL support?
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

jamesodonnell90 avatar image
jamesodonnell90 answered
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 



1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered
Which version of cURL and PHP are you using please?
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

ak avatar image
ak answered Byrne Reese commented
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
1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

jamesodonnell90 avatar image
jamesodonnell90 answered
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 
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

benjamin-dean avatar image
benjamin-dean answered
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.
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys