question

jamesodonnell90 avatar image
jamesodonnell90 asked John Wang commented

PHP cURL not getting a response...

Hi, I'm really having some trouble getting started with this api... I've written the following to get an auth token but I'm getting nothing back in response from the server at all, not even an error am I missing something?

<?php
      ini_set('display_errors', 'On');      error_reporting(E_ALL);        $headers = array();      $headers[] = 'Authorization: Basic TOKEN';      $headers[] = 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8';           $service_url = 'https://platform.ringcentral.com/restapi/oauth/token';         $curl = curl_init($service_url);         $curl_post_data = array(                    'grant_type'  => 'password',             'username'    => 'username',          'extension'   => 'ext',       'password'    => 'password',              );         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);         curl_setopt($curl, CURLOPT_POST, true);         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);      curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);      $curl_response = curl_exec($curl);         curl_close($curl);           $resp = $curl_response;            print_r($resp);     ?>


Thanks


James

oauth
1 |1500 characters needed characters left characters exceeded

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

1 Answer

benjamin-dean avatar image
benjamin-dean answered John Wang commented
Have you tried using our PHP SDK? https://github.com/ringcentral/ringcentral-php 
1 comment
1 |1500 characters needed characters left characters exceeded

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

James,

Please consider the official RingCentral PHP SDK posted by Benjamin:
If you cannot use the official SDK for some reason, you can lift the cURL code from the authCall function here:
0 Likes 0 ·

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