1. Go to this page and download the library: Download ukn0me/b2-api 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/ */
ukn0me / b2-api example snippets
$b2 = new b2_api;
$response = $b2->b2_authorize_account("ACCOUNTID", "APPLICATIONKEY");
return $response;
b2_create_bucket($api_url, $account_id, $auth_token, $bucket_name, $bucket_type)
$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_name // The new bucket's name. 6 char min, 50 char max, letters, digits, - and _ are allowed
$bucket_type // Type to create the bucket as, either allPublic or allPrivate
b2_delete_bucket($api_url, $account_id, $auth_token, $bucket_id)
$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket you want to delete
b2_delete_file_version($api_url, $auth_token, $file_id, $file_name)
$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$file_id // The ID of the file you want to delete
$file_name // The file name of the file you want to delete
b2_download_file_by_id($download_url, $file_id, [$auth_token])
$download_url // The download URL, obtained from the b2_authorize_account call
$file_id // The ID of the file you wish to download
$auth_token // Only
b2_download_file_by_name($download_url, $bucket_name, $file_name, [$auth_token]);
$download_url // The download URL, obtained from the b2_authorize_account call
$bucket_name // The name of the bucket you wish to download from
$file_name // The name of the file you wish to download
$auth_token // Only
b2_get_file_info($api_url, $auth_token, $file_id)
$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$file_id // The ID of the file you wish to recieve the info of
b2_get_upload_url($api_url, $account_id, $auth_token, $bucket_id)
$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket you want to upload to
b2_hide_file($api_url, $auth_token, $bucket_id, $file_name)
$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket containing the file you wish to hide
$file_name // The name of the file you wish to hide
b2_list_buckets($api_url, $auth_token, $account_id)
$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
b2_list_file_names($api_url, $auth_token, $bucket_id, [$options])
$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket containing the files you wish to list
$options = array( // None of these options are
b2_list_file_versions($api_url, $auth_token, $bucket_id, [$options])
$api_url // The API URL, obtained from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket containing the files you wish to list
$options = array( // None of these options are
b2_update_bucket($api_url, $account_id, $auth_token, $bucket_id, $bucket_type)
$api_url // The API URL, obtained from the b2_authorize_account call
$account_id // Obtained from your B2 account page or from the b2_authorize_account call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$bucket_id // The ID of the bucket you want to update
$bucket_type // Type to change to, either allPublic or allPrivate
b2_upload_file($upload_url, $auth_token, $file_path)
$upload_url // Upload URL, obtained from the b2_get_upload_url call
$auth_token // The authentication token, obtained from the b2_authorize_account call
$file_path // The path to the file you wish to upload
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.