Skip to content
This repository has been archived by the owner on Jul 18, 2021. It is now read-only.

[Out of date] ⚙ Light PHP Class for all requests to DropboxAPIv2

License

Notifications You must be signed in to change notification settings

neatek/DropBox-Light-PHP-Class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dropbox SDK Easy to use

  • Get any of DropBox API requests by $class->request('file','..',$params);
  • Working with entries.
  • Share folder or file.
  • Get lastest changes in Dropbox.
  • And many more.
require_once 'dropbox.class.php';
$dropb = new dropbox_neatek_class('HERE_IS_YOUR_TOKEN');

Example (share files in folder):

$params = array(
   'cursor'=> $cursor, // you can get cursor - get_lastest_cursor($folder = '', $params = array())
   'sdk_dp_save'=>true
);
$data = $dropb->request('files', 'list_folder/continue', $params);
foreach ($dropb->get_entries() as $key => $value) {
   $dropb->entry($key);
   if($dropb->entry_is_file() && !$dropb->entry_deleted()) {
   	var_dump($dropb->entry_filepath());
   	var_dump($dropb->heavy_share_path($dropb->entry_filepath(),true));
   }
}

Share file (as well as above, but more code)

$data = $dropb->request('files', 'list_folder/continue', $params);
foreach ($dropb->get_entries() as $key => $value) {
	
	$dropb->entry($key);
	
	if($dropb->entry_is_file() && !$dropb->entry_deleted()) {
		
		var_dump($dropb->entry_filepath());
		
		$dropb->share_path_or_file(
			array(
				'sdk_dp_save' => true, // support next - show_last()
				'path' => $dropb->entry_filepath()
			)
		);
		
		var_dump($dropb->get_shared_link());
		$dropb->show_last(); // file can be already shared, so we can see errors here.

		$params = array(
			'sdk_dp_save' => true,
			'path' => $dropb->entry_filepath()
		);

		var_dump($params);
		
		$data = $dropb->request('sharing', 'list_shared_links', $params);
		//$dropb->show_last();
		//$dropb->show_lastest_params();
		var_dump($dropb->get_shared_links());
		var_dump($dropb->get_shared_link(true));
	}
}

About

[Out of date] ⚙ Light PHP Class for all requests to DropboxAPIv2

Topics

Resources

License

Stars

Watchers

Forks

Languages