Ok, here is the full implementation:
Js
//include js <script type="text/javascript" id="digits-sdk" src="https://cdn.digits.com/1/sdk.js" async></script> <script> document.getElementById('digits-sdk').onload = function() { Digits.init({ consumerKey: '*********' }); }; function onLoginButtonClick(phone_number=''){ if(phone_number!='') { </script>
PHP code
Now that you have a URL and a caption of numbers, you can use the code below:
$apiUrl = 'https://api.digits.com/1.1/sdk/account.json'; $authHeader = 'OAuth oauth_consumer_key="**********", oauth_nonce="****", oauth_signature="****", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1481554529", oauth_token="*****", oauth_version="1.0"'; // Create a stream $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Authorization: {$authHeader}" ) ); $context = stream_context_create($opts); // Open the file using the HTTP headers set above $file = file_get_contents($apiUrl, false, $context); $final_output = array(); if($file) { $final_output = json_decode($file,true); } print_r($final_output);
source share