<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$bucket_id = "";
// The ID of the bucket containing the files you wish to list
$options = array("max_count" => "", "start_id" => "", "start_name" => "");
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_list_file_versions($auth->apiUrl, $auth->authorizationToken, $bucket_id, $options);
// Runs b2_list_file_versions
echo "b2_list_file_versions\n\n";
var_dump($output);
Beispiel #2
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$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 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_hide_file($auth->apiUrl, $auth->authorizationToken, $bucket_id, $file_name);
// Runs b2_hide_file
echo "b2_hide_file\n\n";
var_dump($output);
Beispiel #3
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$file_id = "";
// The ID of the file
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_get_file_info($auth->apiUrl, $auth->authorizationToken, $file_id);
// Runs b2_get_file_info
echo "b2_get_file_info\n\n";
var_dump($output);
Beispiel #4
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$b2 = new b2_api();
// Create a new instance of b2_api
$output = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
echo "b2_authorize_account\n\n";
var_dump($output);
Beispiel #5
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$bucket_id = "";
// Bucket ID, obtained from your B2 bucket page
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_get_upload_url($auth->apiUrl, $auth->accountId, $auth->authorizationToken, $bucket_id);
// Runs b2_get_upload_url
echo "b2_get_upload_url\n\n";
var_dump($output);
Beispiel #6
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$bucket_name = "";
// 6 char min, 50 char max: letters, digits, - and _
$bucket_type = "";
// Either allPublic or allPrivate
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_create_bucket($auth->apiUrl, $auth->accountId, $auth->authorizationToken, $bucket_name, $bucket_type);
// Runs b2_create_bucket
echo "b2_create_bucket\n\n";
var_dump($output);
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$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
$b2 = new b2_api();
// Create a new instance of b2_api
// Public buckets
$public = $b2->b2_download_file_by_name($download_url, $bucket_name, $file_name);
// Runs b2_download_file_by_name
// Private buckets
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$private = $b2->b2_download_file_by_name($download_url, $bucket_name, $file_name, $auth->authorizationToken);
// Runs b2_download_file_by_name with auth
// Output the results
echo "b2_download_file_by_name\n";
echo "\npublic\n";
var_dump($public);
echo "\nprivate\n";
var_dump($private);
Beispiel #8
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$bucket_id = "";
// The ID of the bucket you want to delete
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_delete_bucket($auth->apiUrl, $auth->accountId, $auth->authorizationToken, $bucket_id);
// Runs b2_delete_bucket
echo "b2_delete_bucket\n\n";
var_dump($output);
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$file_id = "";
// The ID of the file you want to delete
$file_name = "";
// The file name of the file you want to delete
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_delete_file_version($auth->apiUrl, $auth->authorizationToken, $file_id, $file_name);
// Runs b2_delete_file_version
echo "b2_delete_file_version\n\n";
var_dump($output);
Beispiel #10
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$bucket_id = "";
// Bucket ID, obtained from your B2 bucket page
$file_path = "";
// Path to the file you wish to upload
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$url = $b2->b2_get_upload_url($auth->apiUrl, $auth->accountId, $auth->authorizationToken, $bucket_id);
// Runs b2_get_upload_url
$output = $b2->b2_upload_file($url->uploadUrl, $url->authorizationToken, $file_path);
// Runs b2_get_upload_url
echo "b2_upload_file\n\n";
var_dump($output);
Beispiel #11
0
<?php

require "../b2_api.php";
// Include the API wrapper
$account_id = "";
// Account ID, obtained from your B2 bucket page
$app_key = "";
// Application ID, obtained from your B2 bucket page
$b2 = new b2_api();
// Create a new instance of b2_api
$auth = $b2->b2_authorize_account($account_id, $app_key);
// Runs b2_authorize_account
$output = $b2->b2_list_buckets($auth->apiUrl, $auth->accountId, $auth->authorizationToken);
// Runs b2_list_buckets
echo "b2_list_buckets\n\n";
var_dump($output);