PHP code example of sshilko / digitsoauth
1. Go to this page and download the library: Download sshilko/digitsoauth library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sshilko / digitsoauth example snippets
$account = new \Digitsoauth\Account($accessToken,
$accessTokenSecret,
$consumerKey,
$consumerSecret);
#calls https://api.digits.com/1.1/sdk/account.json to verify $accessToken
#returns user data (success)
#or Zend_Http_Response (error)
$result = $account->verifyCredentials();
if ($result instanceof \Zend_Http_Response) {
#process errors (network, credentials, ...)
echo (string) $result;
} else {
#got the response array with digits identifier & phone number
$digitsId = $result['id_str'];
$digitsPhone = $result['phone_number'];
}