Box API v2.0 SDK for PHP
I tried to find the PHP SDK for Box API version 2.0 but couldn't find it. I only found SDK for v1.0 https://github.com/box/box-php-sdk Does it exist?
OR
Is it possible to use refresh_token in Box API version 1.0 in this v1.0 sdk https://github.com/box/box-php-sdk ?
+3
source to share
2 answers
Wrote PHP SDK for v2
Just include the api class and run the class:
<?php
include('library/BoxAPI.class.php');
$client_id = 'CLIENT ID';
$client_secret = 'CLIENT SECRET';
$redirect_uri = 'REDIRECT URL';
$box = new Box_API($client_id, $client_secret, $redirect_uri);
if(!$box->load_token()){
if(isset($_GET['code'])){
$token = $box->get_token($_GET['code'], true);
if($box->write_token($token, 'file')){
$box->load_token();
}
} else {
$box->get_code();
}
}
// User details
$box->get_user();
?>
+8
source to share